protocol

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Code

type Code uint8
const (
	CodeRequest  Code = 1
	CodeResponse Code = 2
	CodeSuccess  Code = 3
	CodeFailure  Code = 4
)

type Context

type Context interface {
	Packet() *radius.Request
	RootPayload() Payload

	ProtocolSettings() interface{}

	GetProtocolState(p Type) interface{}
	SetProtocolState(p Type, s interface{})
	IsProtocolStart(p Type) bool

	ResponseModifier
	AddResponseModifier(func(r, q *radius.Packet) error)

	HandleInnerEAP(Payload, StateManager) (Payload, error)
	Inner(Payload, Type) Context
	EndInnerProtocol(Status)

	Log() Logger
}

type Inner

type Inner interface {
	HasInner() Payload
}

type Logger

type Logger interface {
	Debug(msg string, args ...interface{})
	Info(msg string, args ...interface{})
	Warn(msg string, args ...interface{})
	Error(msg string, args ...interface{})
	With(args ...interface{}) Logger
}

type Payload

type Payload interface {
	Decode(raw []byte) error
	Encode() ([]byte, error)
	Handle(ctx Context) Payload
	Type() Type
	Offerable() bool
	String() string
}

type ProtocolConstructor

type ProtocolConstructor func() Payload

type ResponseModifier

type ResponseModifier interface {
	ModifyRADIUSResponse(r *radius.Packet, q *radius.Packet) error
}

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        map[Type]any
}

func BlankState

func BlankState(settings Settings) *State

func (*State) GetNextProtocol

func (st *State) GetNextProtocol() (Type, error)

type StateManager

type StateManager interface {
	GetEAPSettings() Settings
	GetEAPState(string) *State
	SetEAPState(string, *State)
}

type Status

type Status int
const (
	StatusUnknown Status = iota
	StatusSuccess
	StatusError
	StatusNextProtocol
)

type Type

type Type uint8

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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