Documentation
¶
Index ¶
- Variables
- type APFHandler
- func (h *APFHandler) DeviceID() string
- func (h *APFHandler) OnAuthRequest(request apf.AuthRequest) apf.AuthResponse
- func (h *APFHandler) OnGlobalRequest(request apf.GlobalRequest) bool
- func (h *APFHandler) OnProtocolVersion(info apf.ProtocolVersionInfo) error
- func (h *APFHandler) ShouldSendKeepAlive() bool
- type Server
Constants ¶
This section is empty.
Variables ¶
var ( // ErrChannelOpenFailed is returned when an APF channel open request fails. ErrChannelOpenFailed = errors.New("channel open failed") )
Functions ¶
This section is empty.
Types ¶
type APFHandler ¶
type APFHandler struct {
// contains filtered or unexported fields
}
APFHandler implements apf.Handler for the CIRA server. It provides application-specific logic for authentication and device registration.
func NewAPFHandler ¶
func NewAPFHandler(d devices.Feature, l logger.Interface) *APFHandler
NewAPFHandler creates a new APF handler with access to the devices feature.
func (*APFHandler) DeviceID ¶
func (h *APFHandler) DeviceID() string
DeviceID returns the device ID extracted from the protocol version message.
func (*APFHandler) OnAuthRequest ¶
func (h *APFHandler) OnAuthRequest(request apf.AuthRequest) apf.AuthResponse
OnAuthRequest is called when an APF_USERAUTH_REQUEST message is received. Validates credentials against the database.
func (*APFHandler) OnGlobalRequest ¶
func (h *APFHandler) OnGlobalRequest(request apf.GlobalRequest) bool
OnGlobalRequest is called when an APF_GLOBAL_REQUEST message is received. Tracks TCP forwarding requests and returns true when keep-alive should be sent.
func (*APFHandler) OnProtocolVersion ¶
func (h *APFHandler) OnProtocolVersion(info apf.ProtocolVersionInfo) error
OnProtocolVersion is called when an APF_PROTOCOLVERSION message is received. Extracts and stores the device UUID for later use.
func (*APFHandler) ShouldSendKeepAlive ¶
func (h *APFHandler) ShouldSendKeepAlive() bool
ShouldSendKeepAlive returns whether keep-alive should be sent based on global request count.