@ -8,7 +8,7 @@ import (
|
||||
|
||||
type context struct {
|
||||
req *radius.Request
|
||||
state interface{}
|
||||
rootPayload protocol.Payload
|
||||
typeState map[protocol.Type]any
|
||||
log *log.Entry
|
||||
settings interface{}
|
||||
@ -16,21 +16,17 @@ type context struct {
|
||||
endModifier func(p *radius.Packet) *radius.Packet
|
||||
}
|
||||
|
||||
func (ctx *context) Packet() *radius.Request { return ctx.req }
|
||||
func (ctx *context) ProtocolSettings() interface{} { return ctx.settings }
|
||||
func (ctx *context) StateForProtocol(p protocol.Type) interface{} { return ctx.typeState[p] }
|
||||
func (ctx *context) GetProtocolState() interface{} { return ctx.state }
|
||||
func (ctx *context) SetProtocolState(st interface{}) { ctx.state = st }
|
||||
func (ctx *context) IsProtocolStart() bool { return ctx.state == nil }
|
||||
func (ctx *context) Log() *log.Entry { return ctx.log }
|
||||
func (ctx *context) RootPayload() protocol.Payload { return ctx.rootPayload }
|
||||
func (ctx *context) Packet() *radius.Request { return ctx.req }
|
||||
func (ctx *context) ProtocolSettings() interface{} { return ctx.settings }
|
||||
func (ctx *context) GetProtocolState(p protocol.Type) interface{} { return ctx.typeState[p] }
|
||||
func (ctx *context) SetProtocolState(p protocol.Type, st interface{}) { ctx.typeState[p] = st }
|
||||
func (ctx *context) IsProtocolStart(p protocol.Type) bool { return ctx.typeState[p] == nil }
|
||||
func (ctx *context) Log() *log.Entry { return ctx.log }
|
||||
|
||||
func (ctx *context) ForInnerProtocol(p protocol.Type) protocol.Context {
|
||||
log.Debug("foo")
|
||||
log.Debugf("%+v", ctx.typeState[protocol.Type(13)])
|
||||
log.Debugf("%+v", ctx.typeState[protocol.Type(25)])
|
||||
return &context{
|
||||
req: ctx.req,
|
||||
state: ctx.StateForProtocol(p),
|
||||
typeState: ctx.typeState,
|
||||
log: ctx.log,
|
||||
settings: ctx.settings,
|
||||
|
||||
Reference in New Issue
Block a user