types

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package types defines RADIUS protocol constants shared across the packet, crypto, dictionary, transport, and protocol packages.

All values are derived from the authoritative RFCs:

  • RFC 2865: RADIUS (base) — Codes 1-3, 11-13, 255; attributes 1-39, 60-63
  • RFC 2866: RADIUS Accounting — Codes 4-5; attributes 40-51
  • RFC 2869: RADIUS Extensions — attributes 79-80
  • RFC 5176: Dynamic Authorization — Codes 43-48

Index

Constants

View Source
const (
	AttrUserName               = 1
	AttrUserPassword           = 2
	AttrCHAPPassword           = 3
	AttrNASIPAddress           = 4
	AttrNASPort                = 5
	AttrServiceType            = 6
	AttrFramedProtocol         = 7
	AttrFramedIPAddress        = 8
	AttrFramedIPNetmask        = 9
	AttrFramedRouting          = 10
	AttrFilterID               = 11
	AttrFramedMTU              = 12
	AttrFramedCompression      = 13
	AttrLoginIPHost            = 14
	AttrLoginService           = 15
	AttrLoginTCPPort           = 16
	AttrReplyMessage           = 18
	AttrCallbackNumber         = 19
	AttrCallbackID             = 20
	AttrFramedRoute            = 22
	AttrFramedIPXNetwork       = 23
	AttrState                  = 24
	AttrClass                  = 25
	AttrVendorSpecific         = 26
	AttrSessionTimeout         = 27
	AttrIdleTimeout            = 28
	AttrTerminationAction      = 29
	AttrCalledStationID        = 30
	AttrCallingStationID       = 31
	AttrNASIdentifier          = 32
	AttrProxyState             = 33
	AttrLoginLATService        = 34
	AttrLoginLATNode           = 35
	AttrLoginLATGroup          = 36
	AttrFramedAppleTalkLink    = 37
	AttrFramedAppleTalkNetwork = 38
	AttrFramedAppleTalkZone    = 39
	AttrCHAPChallenge          = 60
	AttrNASPortType            = 61
	AttrPortLimit              = 62
	AttrLoginLATPort           = 63
)

Standard attribute type numbers defined by RFC 2865 §5. Each constant name uses the RFC attribute name in CamelCase with an Attr prefix.

View Source
const (
	AttrAcctStatusType     = 40
	AttrAcctDelayTime      = 41
	AttrAcctInputOctets    = 42
	AttrAcctOutputOctets   = 43
	AttrAcctSessionID      = 44
	AttrAcctAuthentic      = 45
	AttrAcctSessionTime    = 46
	AttrAcctInputPackets   = 47
	AttrAcctOutputPackets  = 48
	AttrAcctTerminateCause = 49
	AttrAcctMultiSessionID = 50
	AttrAcctLinkCount      = 51
)

Accounting attribute type numbers defined by RFC 2866 §5.

View Source
const (
	AttrEAPMessage           = 79
	AttrMessageAuthenticator = 80
	AttrNASPortID            = 87
	AttrAcctInterimInterval  = 85
)

Extension attribute type numbers defined by RFC 2869.

View Source
const (
	AttrARAPPassword     = 70
	AttrARAPFeatures     = 71
	AttrARAPZoneAccess   = 72
	AttrARAPSecurity     = 73
	AttrARAPSecurityData = 74
)

ARAP attribute type numbers defined by RFC 2869 §5.6–5.10. Used by the legacy Apple Remote Access Protocol; rarely seen on modern networks but part of the standard dictionary.

View Source
const (
	AttrPasswordRetry      = 75
	AttrPrompt             = 76
	AttrConnectInfo        = 77
	AttrConfigurationToken = 78
	AttrFramedPool         = 88
)

Additional RFC 2869 attribute type numbers.

View Source
const (
	AttrNASIPv6Address    = 95
	AttrFramedInterfaceID = 96
	AttrFramedIPv6Prefix  = 97
	AttrLoginIPv6Host     = 98
	AttrFramedIPv6Route   = 99
	AttrFramedIPv6Pool    = 100
)

IPv6 attribute type numbers defined by RFC 3162.

View Source
const (
	AttrTunnelType           = 64
	AttrTunnelMediumType     = 65
	AttrTunnelClientEndpoint = 66
	AttrTunnelServerEndpoint = 67
	AttrTunnelPassword       = 69
	AttrTunnelPrivateGroupID = 81
	AttrTunnelAssignmentID   = 82
	AttrTunnelPreference     = 83
	AttrTunnelClientAuthID   = 90
	AttrTunnelServerAuthID   = 91
)

Tunnel attribute type numbers defined by RFC 2868.

View Source
const (
	AttrExtendedType1 = 241 // RFC 6929 §2.1: extended (255-octet value)
	AttrExtendedType2 = 242 // RFC 6929 §2.2: long extended (4111-octet value)
	AttrExtendedType3 = 243 // RFC 6929 §2.3: extended (255-octet value)
	AttrExtendedType4 = 244 // RFC 6929 §2.4: extended (255-octet value)
)

RFC 6929 extended attribute type numbers. These type codes introduce the "extended" attribute format that allows more than 255 attributes and longer values (up to 4111 octets for "long extended" types). The dictionary marks them as TypeExtended; full codec support is implemented alongside the extended-attribute handling in the packet layer.

View Source
const (
	PacketMinLength        = 20
	PacketMaxLengthRFC2865 = 4096
	PacketMaxLengthRFC2866 = 4095

	AuthenticatorLength = 16

	AttrMinLength      = 2
	AttrMaxLength      = 255
	AttrValueMaxLength = 253

	// UserPasswordMaxLength bounds the cleartext password length before
	// padding to a 16-byte boundary (RFC 2865 §5.2: String is 16..128 octets).
	UserPasswordMaxLength = 128
)

Packet and attribute length limits.

RFC 2865 §3: minimum length 20, maximum length 4096. RFC 2866 §3: minimum length 20, maximum length 4095 (one less). A single attribute occupies 2..255 bytes (Type + Length + Value), so Value is at most 253 bytes.

View Source
const (
	PortAuth       = 1812
	PortAccounting = 1813
	PortCoA        = 3799
	PortTCP        = 5080 // RFC 6613
)

Well-known UDP ports.

View Source
const AttrErrorCause = 101

Error-Cause attribute (RFC 5176 §3.3). Used in CoA/NAK and Disconnect/NAK.

Variables

This section is empty.

Functions

This section is empty.

Types

type Code

type Code byte

Code identifies the type of a RADIUS packet. It occupies one octet at the start of every packet. See RFC 2865 §3 and RFC 5176 §2.1.

const (
	AccessRequest      Code = 1
	AccessAccept       Code = 2
	AccessReject       Code = 3
	AccountingRequest  Code = 4
	AccountingResponse Code = 5
	AccessChallenge    Code = 11
	StatusServer       Code = 12 // experimental
	StatusClient       Code = 13 // experimental
	Reserved           Code = 255
)

Packet codes defined by RFC 2865 §3.

const (
	CoARequest        Code = 43
	CoAACK            Code = 44
	CoANAK            Code = 45
	DisconnectRequest Code = 46
	DisconnectACK     Code = 47
	DisconnectNAK     Code = 48
)

Packet codes defined by RFC 5176 for Change-of-Authorization and Disconnect-Message flows.

func (Code) IsAccess

func (c Code) IsAccess() bool

IsAccess reports whether c is an authentication-family code (Access-Request/Accept/Reject/Challenge).

func (Code) IsAccounting

func (c Code) IsAccounting() bool

IsAccounting reports whether c is an accounting-family code (Accounting-Request/Response) as defined by RFC 2866.

func (Code) IsDynamicAuthorization

func (c Code) IsDynamicAuthorization() bool

IsDynamicAuthorization reports whether c is a CoA or Disconnect code as defined by RFC 5176.

func (Code) String

func (c Code) String() string

String returns the canonical name of the code, or "Unknown" if unrecognized.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL