package radius

import "io"

// AttributeType defines types for an Attribute
type AttributeType int64

const (

	// Attributes for RFC2866/Radius accounting
	AccountingStatusType     AttributeType = 40
	AccountingDelayTime      AttributeType = 41
	AccountingInputOctets    AttributeType = 42
	AccountingOutputOctets   AttributeType = 43
	AccountingSessionID      AttributeType = 44
	AccountingAuthentic      AttributeType = 45
	AccountingSessionTime    AttributeType = 46
	AccountingInputPackets   AttributeType = 47
	AccountingOutputPackets  AttributeType = 48
	AccountingTerminateCause AttributeType = 49
	AccountingMultiSessionID AttributeType = 50
	AccountingMultiLinkCount AttributeType = 51
	// --

)

// Write writes the attribute type to the given writer
func (a AttributeType) Write(w io.Writer) error {
	_, err := w.Write([]byte{byte(a)})
	return err
}

package radius

import (
	"encoding/binary"
	"io"
)

// AttributeType defines types for an Attribute
type AttributeType int64

const (

	// Attributes for RFC2866/Radius accounting
	AccountingStatusType     AttributeType = 40
	AccountingDelayTime      AttributeType = 41
	AccountingInputOctets    AttributeType = 42
	AccountingOutputOctets   AttributeType = 43
	AccountingSessionID      AttributeType = 44
	AccountingAuthentic      AttributeType = 45
	AccountingSessionTime    AttributeType = 46
	AccountingInputPackets   AttributeType = 47
	AccountingOutputPackets  AttributeType = 48
	AccountingTerminateCause AttributeType = 49
	AccountingMultiSessionID AttributeType = 50
	AccountingMultiLinkCount AttributeType = 51
	// --

)

// Write writes the attribute type to the given writer
func (a AttributeType) Write(w io.Writer) error {
	return binary.Write(w, binary.BigEndian, int8(a))
}

--- 
+++ 
@@ -1,9 +1,6 @@
 package radius
 
-import (
-	"encoding/binary"
-	"io"
-)
+import "io"
 
 // AttributeType defines types for an Attribute
 type AttributeType int64
@@ -29,5 +26,6 @@
 
 // Write writes the attribute type to the given writer
 func (a AttributeType) Write(w io.Writer) error {
-	return binary.Write(w, binary.BigEndian, int8(a))
+	_, err := w.Write([]byte{byte(a)})
+	return err
 }
Remove unnecesary endianness from attribute type writer
