Documentation
¶
Overview ¶
Package client provides ready-to-use RADIUS clients built on top of the transport and protocol packages.
The protocol.Client is transport-agnostic; callers must inject a transport that satisfies protocol.Transport (transport.UDPClient and transport.TCPClient both do). This package removes that wiring burden with two constructors:
- NewUDPClient dials a UDP socket to a server and wraps a protocol.Client around it. Retransmission is enabled by default (RFC 2865 §2.5).
- NewTCPClient dials a single TCP connection to a server and wraps a protocol.Client around it. Retransmission is disabled by default (RFC 6613 §2.6.1).
Both constructors accept functional options for timeout, retransmission policy, logging, and per-protocol-family secret selection.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Network selects "udp" / "udp4" / "udp6" for UDP clients, or
// "tcp" / "tcp4" / "tcp6" for TCP clients. Defaults to "udp4" or
// "tcp4" respectively when empty.
Network string
// Timeout is the default per-exchange deadline applied to every
// Authenticate / Account / SendCoA / SendDisconnect call when the
// caller does not supply its own context deadline. Zero disables
// the default deadline (calls block until the server replies or the
// retransmission policy is exhausted).
Timeout time.Duration
// Retransmit governs UDP retransmission. When zero a default policy
// of 3 attempts with 2s/16s backoff is used. Ignored for TCP clients
// (always single-attempt per RFC 6613 §2.6.1).
Retransmit protocol.RetransmitPolicy
// Logger injected into the underlying protocol.Client. nil falls
// back to log.Default (NopLogger unless the application called
// log.SetDefault).
Logger radiuslog.Logger
}
Config controls the behavior of a constructed Client. Zero values fall back to sensible defaults documented per-field.
type TCPClient ¶
TCPClient is a protocol.Client configured to exchange packets with a single RADIUS server over TCP (RFC 6613).
func NewTCPClient ¶
NewTCPClient dials a TCP connection to server and returns a Client ready for Authenticate / Account / SendCoA / SendDisconnect calls.
Per RFC 6613 §2.6.1 no retransmission is performed on a TCP connection; the Config.Retransmit field is ignored and the client uses a single-attempt policy.
type UDPClient ¶
UDPClient is a protocol.Client configured to exchange packets with a single RADIUS server over UDP. The underlying transport.UDPClient is exposed via Transport for advanced callers that need to send raw bytes.
func NewUDPClient ¶
NewUDPClient dials a UDP socket to server and returns a Client ready for Authenticate / Account / SendCoA / SendDisconnect calls.
secret is the RADIUS shared secret used for authenticator computation and User-Password encryption. It MUST NOT be empty.