forked from nsd20463/radius
-
Notifications
You must be signed in to change notification settings - Fork 0
/
attribute.go
28 lines (24 loc) · 904 Bytes
/
attribute.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package radius
// Attribute is a RADIUS attribute, which is part of a RADIUS packet.
type Attribute struct {
Type byte
Value interface{}
VendorId uint32
}
// AttributeCodec defines how an Attribute is encoded and decoded to and from
// wire data.
type AttributeCodec interface {
// Note: do not store wire; make a copy of it.
Decode(packet *Packet, wire []byte) (interface{}, error)
Encode(packet *Packet, value interface{}) ([]byte, error)
}
// AttributeTransformer defines an extension of AttributeCodec. It provides a
// method for converting attribute values to ones permitted by the attribute.
type AttributeTransformer interface {
Transform(value interface{}) (interface{}, error)
}
// AttributeStringer defines an extension of AttributeCodec. It provides a
// method for converting an attribute value to a string.
type AttributeStringer interface {
String(value interface{}) string
}