errors

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: 1 Imported by: 0

Documentation

Overview

Package errors defines the sentinel errors returned by the radius library.

All errors use the "radius: " prefix and are comparable with errors.Is, enabling callers to branch on specific failure modes without string matching.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrShortBuffer   = New("buffer too short")
	ErrInvalidLength = New("invalid length field")
)

Buffer and framing errors.

View Source
var (
	ErrInvalidCode           = New("invalid code")
	ErrAuthenticatorMismatch = New("authenticator mismatch")
)

Packet-level errors.

View Source
var (
	ErrInvalidAttribute = New("invalid attribute")
	ErrAttributeTooLong = New("attribute value exceeds 253 octets")
	ErrUnknownAttribute = New("unknown attribute type")
)

Attribute-level errors.

View Source
var (
	ErrSecretEmpty     = New("shared secret must not be empty")
	ErrPasswordTooLong = New("password exceeds 128 octets")
)

Crypto and secret errors.

View Source
var (
	ErrMessageAuthenticatorMissing  = New("message-authenticator required but missing")
	ErrMessageAuthenticatorMismatch = New("message-authenticator verification failed")
)

Message-Authenticator (RFC 2869 §5.14) errors.

View Source
var (
	// ErrTimeout indicates a context deadline was exceeded while waiting
	// for a network operation. Wrap-aware callers may also match
	// context.DeadlineExceeded directly.
	ErrTimeout = New("operation timed out")

	// ErrConnClosed is returned by ReadPacket / SendPacket / Exchange after
	// the underlying socket or TCP connection has been closed.
	ErrConnClosed = New("connection closed")

	// ErrMalformedPacket indicates a TCP framing failure: the RADIUS Length
	// field is out of bounds, attributes do not fill the declared Length, or
	// a partial read could not be completed. Per RFC 6613 §2.6.4 the caller
	// should close the TCP connection when this is returned.
	ErrMalformedPacket = New("malformed RADIUS packet")

	// ErrUnknownPeer is returned by UDPClient.Exchange when a reply is
	// received from a source address that does not match the configured
	// server. Per RFC 2865 §3 the stray packet is silently discarded and
	// Exchange continues to wait for the legitimate reply (subject to the
	// context deadline).
	ErrUnknownPeer = New("packet from unknown peer")
)

Transport-layer errors. Returned by the transport package for network and framing failures; safe to branch on with errors.Is.

Functions

func As

func As(err error, target any) bool

As finds the first error in err's chain that matches the target type.

func Is

func Is(err, target error) bool

Is reports whether any error in err's chain matches the target.

Re-exported for convenience so callers can import only this package.

func New

func New(text string) error

New wraps errors.New with the radius: prefix convention.

Exported so that subpackages can define additional sentinel errors with a consistent prefix.

Types

This section is empty.

Jump to

Keyboard shortcuts

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