Documentation
¶
Overview ¶
Package radius is the top-level entry point for the wxccs/radius library. It re-exports the most commonly used symbols from the protocol, packet, server, client, and types packages so that applications can use the library with a single import:
c, err := radius.NewUDPClient(addr, secret, radius.Config{Timeout: 5 * time.Second})
resp, err := c.Authenticate(ctx, radius.NewAccessRequest().PAP("alice", "pw").Build())
The subpackages remain the source of truth for richer APIs (dictionary, crypto, transport, integration helpers). Symbols not re-exported here can be reached by importing the corresponding subpackage directly; no symbol is hidden — this package only re-exports, never wraps.
Index ¶
- Constants
- Variables
- type AccessRequestBuilder
- type AccountingRequestBuilder
- type Attribute
- type AuthMethod
- type CoARequestBuilder
- type Code
- type Config
- type DisconnectRequestBuilder
- type Handler
- type HandlerFunc
- type Mux
- type Packet
- type Request
- type SecretLookup
- type TCPClient
- type TCPServer
- type UDPClient
- type UDPServer
Constants ¶
const ( AccessRequest = types.AccessRequest AccessAccept = types.AccessAccept AccessReject = types.AccessReject AccountingRequest = types.AccountingRequest AccountingResponse = types.AccountingResponse AccessChallenge = types.AccessChallenge CoARequest = types.CoARequest CoAACK = types.CoAACK CoANAK = types.CoANAK DisconnectRequest = types.DisconnectRequest DisconnectACK = types.DisconnectACK DisconnectNAK = types.DisconnectNAK )
Packet codes from RFC 2865, RFC 2866, and RFC 5176.
const ( AttrUserName = types.AttrUserName AttrUserPassword = types.AttrUserPassword AttrCHAPPassword = types.AttrCHAPPassword AttrNASIPAddress = types.AttrNASIPAddress AttrNASPort = types.AttrNASPort AttrServiceType = types.AttrServiceType AttrFramedIPAddress = types.AttrFramedIPAddress AttrFramedIPNetmask = types.AttrFramedIPNetmask AttrFilterID = types.AttrFilterID AttrReplyMessage = types.AttrReplyMessage AttrState = types.AttrState AttrClass = types.AttrClass AttrVendorSpecific = types.AttrVendorSpecific AttrSessionTimeout = types.AttrSessionTimeout AttrIdleTimeout = types.AttrIdleTimeout AttrCalledStationID = types.AttrCalledStationID AttrCallingStationID = types.AttrCallingStationID AttrNASIdentifier = types.AttrNASIdentifier AttrProxyState = types.AttrProxyState AttrNASPortType = types.AttrNASPortType AttrAcctStatusType = types.AttrAcctStatusType AttrAcctDelayTime = types.AttrAcctDelayTime AttrAcctInputOctets = types.AttrAcctInputOctets AttrAcctOutputOctets = types.AttrAcctOutputOctets AttrAcctSessionID = types.AttrAcctSessionID AttrAcctAuthentic = types.AttrAcctAuthentic AttrAcctSessionTime = types.AttrAcctSessionTime AttrAcctInputPackets = types.AttrAcctInputPackets AttrAcctOutputPackets = types.AttrAcctOutputPackets AttrAcctTerminateCause = types.AttrAcctTerminateCause AttrAcctMultiSessionID = types.AttrAcctMultiSessionID AttrEAPMessage = types.AttrEAPMessage AttrMessageAuthenticator = types.AttrMessageAuthenticator AttrNASPortID = types.AttrNASPortID AttrAcctInterimInterval = types.AttrAcctInterimInterval AttrNASIPv6Address = types.AttrNASIPv6Address AttrFramedIPv6Prefix = types.AttrFramedIPv6Prefix AttrFramedIPv6Pool = types.AttrFramedIPv6Pool AttrErrorCause = types.AttrErrorCause )
Commonly-used attribute type numbers from RFC 2865 / 2866 / 2869 / 3162 / 5176. The full list lives in the types package.
const ( PortAuth = types.PortAuth PortAccounting = types.PortAccounting PortCoA = types.PortCoA PortTCP = types.PortTCP )
UDP and TCP ports for RADIUS services (RFC 2865, RFC 2866, RFC 5176, RFC 6613).
const ( AuthPAP = protocol.AuthPAP AuthEAP = protocol.AuthEAP )
Authentication methods.
const AuthenticatorLength = types.AuthenticatorLength
AuthenticatorLength is the fixed length in bytes of the Request/Response Authenticator field.
Variables ¶
var ( NewString = packet.NewString NewInteger = packet.NewInteger NewIPAddr = packet.NewIPAddr NewIPv6Addr = packet.NewIPv6Addr NewOctets = packet.NewOctets NewVendorSpecific = packet.NewVendorSpecific )
Attribute and packet constructors re-exported from the packet package.
var ( NewAccessRequest = protocol.NewAccessRequest NewAccountingRequest = protocol.NewAccountingRequest NewCoARequest = protocol.NewCoARequest NewDisconnectRequest = protocol.NewDisconnectRequest )
Request builders. NewAccessRequest returns a fluent builder whose Build method yields a *protocol.AccessRequest suitable for Client.Authenticate. The other builders behave analogously for Account, SendCoA, and SendDisconnect.
The response struct types (protocol.AccessResponse, protocol.CoAResponse, etc.) are intentionally NOT re-exported here: the names AccessRequest, AccountingRequest, CoARequest, DisconnectRequest, and AccountingResponse refer to the RADIUS packet Code constants from the types package, and Go does not permit a type and a const to share a name. Callers receive the response via short variable declaration (resp, err := c.Authenticate(...)) or import the protocol package directly when a named type is required.
var ( NewUDPClient = client.NewUDPClient NewTCPClient = client.NewTCPClient )
NewUDPClient dials a UDP socket to a RADIUS server and returns a ready Client. NewTCPClient dials a single TCP connection (RFC 6613) instead.
var ( NewUDPServer = server.NewUDPServer NewTCPServer = server.NewTCPServer StaticSecret = server.StaticSecret SecretMap = server.SecretMap NewMux = server.NewMux )
Server constructors and helpers.
Functions ¶
This section is empty.
Types ¶
type AccessRequestBuilder ¶
type AccessRequestBuilder = protocol.AccessRequestBuilder
Builder types re-exported so callers can declare variables of these types.
type AccountingRequestBuilder ¶
type AccountingRequestBuilder = protocol.AccountingRequestBuilder
Builder types re-exported so callers can declare variables of these types.
type AuthMethod ¶
type AuthMethod = protocol.AuthMethod
AuthMethod selects how the Access-Request carries user credentials.
type CoARequestBuilder ¶
type CoARequestBuilder = protocol.CoARequestBuilder
Builder types re-exported so callers can declare variables of these types.
type DisconnectRequestBuilder ¶
type DisconnectRequestBuilder = protocol.DisconnectRequestBuilder
Builder types re-exported so callers can declare variables of these types.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package client provides ready-to-use RADIUS clients built on top of the transport and protocol packages.
|
Package client provides ready-to-use RADIUS clients built on top of the transport and protocol packages. |
|
cmd
|
|
|
dict-gen
command
Command dict-gen reads one or more FreeRADIUS dictionary files and emits a Go source file with typed constants and accessor functions.
|
Command dict-gen reads one or more FreeRADIUS dictionary files and emits a Go source file with typed constants and accessor functions. |
|
radius-tool
command
Package main is the entry point for the radius-tool command-line utility.
|
Package main is the entry point for the radius-tool command-line utility. |
|
Package crypto implements the cryptographic primitives used by the RADIUS protocol:
|
Package crypto implements the cryptographic primitives used by the RADIUS protocol: |
|
Package dictionary maps RADIUS attribute type numbers to human-readable metadata: the attribute name, the wire encoding of its Value (string, integer, IP address, raw octets, vendor-specific, or RFC 6929 extended), whether the value is encrypted on the wire, and whether it carries an RFC 2868 tag.
|
Package dictionary maps RADIUS attribute type numbers to human-readable metadata: the attribute name, the wire encoding of its Value (string, integer, IP address, raw octets, vendor-specific, or RFC 6929 extended), whether the value is encrypted on the wire, and whether it carries an RFC 2868 tag. |
|
gen
Package gen emits Go source code from a parsed FreeRADIUS dictionary.
|
Package gen emits Go source code from a parsed FreeRADIUS dictionary. |
|
parser
Package parser reads FreeRADIUS-format dictionary files and produces a Dict — a pure data structure describing attributes, enum values, and vendors.
|
Package parser reads FreeRADIUS-format dictionary files and produces a Dict — a pure data structure describing attributes, enum values, and vendors. |
|
Package errors defines the sentinel errors returned by the radius library.
|
Package errors defines the sentinel errors returned by the radius library. |
|
Package log defines the logging interface used across the radius library.
|
Package log defines the logging interface used across the radius library. |
|
Package packet implements the RADIUS packet wire format: the 20-byte header (Code, Identifier, Length, Authenticator) followed by a sequence of TLV attributes.
|
Package packet implements the RADIUS packet wire format: the 20-byte header (Code, Identifier, Length, Authenticator) followed by a sequence of TLV attributes. |
|
Package protocol implements the RADIUS state machines on top of the packet and transport layers.
|
Package protocol implements the RADIUS state machines on top of the packet and transport layers. |
|
Package server implements a RADIUS server framework over the transport and packet layers.
|
Package server implements a RADIUS server framework over the transport and packet layers. |
|
Package transport provides UDP (RFC 2865, RFC 3162) and TCP (RFC 6613) transports for RADIUS packets.
|
Package transport provides UDP (RFC 2865, RFC 3162) and TCP (RFC 6613) transports for RADIUS packets. |
|
Package types defines RADIUS protocol constants shared across the packet, crypto, dictionary, transport, and protocol packages.
|
Package types defines RADIUS protocol constants shared across the packet, crypto, dictionary, transport, and protocol packages. |
|
Package vendors provides shared helpers for constructing and decoding Vendor-Specific (Type 26) attributes in the RFC 2865 §5.26 wire format:
|
Package vendors provides shared helpers for constructing and decoding Vendor-Specific (Type 26) attributes in the RFC 2865 §5.26 wire format: |
|
alcatel
Package alcatel implements Vendor-Specific attributes for Alcatel (SMI Network Management Private Enterprise Code 800).
|
Package alcatel implements Vendor-Specific attributes for Alcatel (SMI Network Management Private Enterprise Code 800). |
|
cisco
Package cisco implements Vendor-Specific attributes for Cisco Systems (SMI Network Management Private Enterprise Code 9).
|
Package cisco implements Vendor-Specific attributes for Cisco Systems (SMI Network Management Private Enterprise Code 9). |
|
h3c
Package h3c implements Vendor-Specific attributes for H3C (Hangzhou H3C Technologies / New H3C Technologies), which inherited the 3Com SMI Network Management Private Enterprise Code 2011.
|
Package h3c implements Vendor-Specific attributes for H3C (Hangzhou H3C Technologies / New H3C Technologies), which inherited the 3Com SMI Network Management Private Enterprise Code 2011. |
|
juniper
Package juniper implements Vendor-Specific attributes for Juniper Networks (SMI Network Management Private Enterprise Code 2636).
|
Package juniper implements Vendor-Specific attributes for Juniper Networks (SMI Network Management Private Enterprise Code 2636). |
|
microsoft
Package microsoft implements Vendor-Specific attributes for Microsoft (SMI Network Management Private Enterprise Code 311).
|
Package microsoft implements Vendor-Specific attributes for Microsoft (SMI Network Management Private Enterprise Code 311). |
|
redback
Package redback implements Vendor-Specific attributes for Redback Networks (SMI Network Management Private Enterprise Code 2352), now part of Ericsson.
|
Package redback implements Vendor-Specific attributes for Redback Networks (SMI Network Management Private Enterprise Code 2352), now part of Ericsson. |