Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context interface {
Packet() *radius.Request
RootPayload() Payload
State() string
ProtocolSettings() interface{}
GetProtocolState(p Type) interface{}
SetProtocolState(p Type, s interface{})
IsProtocolStart(p Type) bool
// SessionValue / SetSessionValue access the session-scoped store shared by
// every protocol handled under the same RADIUS State (see State.SessionData).
SessionValue(key string) any
SetSessionValue(key string, value any)
ResponseModifier
AddResponseModifier(func(r, q *radius.Packet) error)
HandleInnerEAP(Payload, StateManager) (Payload, error)
Inner(Payload, Type) Context
EndInnerProtocol(Status)
Log() Logger
}
type ProtocolConstructor ¶
type ProtocolConstructor func() Payload
type ResponseModifier ¶
type Settings ¶
type Settings struct {
Protocols []ProtocolConstructor
ProtocolPriority []Type
ProtocolSettings map[Type]interface{}
Logger Logger
}
type State ¶
type State struct {
Protocols []ProtocolConstructor
ProtocolIndex int
ProtocolPriority []Type
// TypeState holds each method's per-session state. It is shared by every
// protocol handled under the same RADIUS State and is accessed both by the
// request handler and by the background TLS handshake goroutine (via the
// VerifyConnection / HandshakeSuccessful callbacks), so it must only be
// touched through ProtocolState/SetProtocolState/IsProtocolStart, which guard
// it with typeMu.
TypeState map[Type]any
// SessionData is a free-form, session-scoped store shared across every
// protocol (outer and inner) handled under the same RADIUS State. Consumers
// use Context.SessionValue/SetSessionValue to stash request-spanning data
// (resolved identity, certificates, OTP progress, response attributes)
// without maintaining a parallel, separately-locked map. Access it only
// through SessionValue/SetSessionValue, which guard it with sessionMu so it
// is safe to use from callbacks that run on the background TLS handshake
// goroutine (e.g. VerifyConnection, HandshakeSuccessful).
SessionData map[string]any
// contains filtered or unexported fields
}
func BlankState ¶
func (*State) GetNextProtocol ¶
func (*State) IsProtocolStart ¶ added in v0.2.1
IsProtocolStart reports whether a method has no stored state yet. Safe for concurrent use.
func (*State) ProtocolState ¶ added in v0.2.1
ProtocolState returns the stored state for a method type (nil if none). Safe for concurrent use.
func (*State) SessionValue ¶ added in v0.2.0
SessionValue returns the session-scoped value for key, or nil if absent.
func (*State) SetProtocolState ¶ added in v0.2.1
SetProtocolState stores the state for a method type, lazily allocating the backing map. Safe for concurrent use.
func (*State) SetSessionValue ¶ added in v0.2.0
SetSessionValue stores a session-scoped value, lazily allocating the backing map. It is safe for concurrent use.
type StateManager ¶
Click to show internal directories.
Click to hide internal directories.