Documentation
¶
Index ¶
- Variables
- type ConnBuf
- type Protocol
- type ProtocolManager
- func (pm *ProtocolManager) FindAction(ctx context.Context, cBuf *ConnBuf) (config.Action, error)
- func (pm *ProtocolManager) GetProtocol(name config.Protocol) Protocol
- func (pm *ProtocolManager) ImportProtocolGroup(pg config.ProtocolGroup) error
- func (pm *ProtocolManager) RegisterProtocol(p Protocol)
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotEnoughData = errors.New("not enough data in buffer")
)
Functions ¶
This section is empty.
Types ¶
type ConnBuf ¶
type ConnBuf struct {
// contains filtered or unexported fields
}
Thread-safe buffer in order to allow inspection of the connection
func NewConnBuf ¶
func NewConnBuf() *ConnBuf
type Protocol ¶
type Protocol interface {
// Name prints the name of the protocol, like "TLS", which is going to be used as a key in the ProtocolGroup
Name() config.Protocol
// Clone creates a new Protocol instance with the same rules (as a deep copy)
Clone() Protocol
// ApplyRules save the rules for later Identify calls.
// Note the rules are out-of-order intentionally to prevent conflicting rules.
// Protocol implementations should make sure the CATCHEALL rule is always the last rule to be applied.
ApplyRules(rules []config.Rule) error
// Identify identifies the rule that matches the request.
Identify(ctx context.Context, cBuf *ConnBuf) (config.Rule, error) // Identify will keep checking cBuf until it can make a deterministic decision or the context is cancelled.
}
Protocol is the interface for protocol identification.
type ProtocolManager ¶
type ProtocolManager struct {
// contains filtered or unexported fields
}
func NewProtocolManager ¶
func NewProtocolManager() *ProtocolManager
func (*ProtocolManager) FindAction ¶
func (*ProtocolManager) GetProtocol ¶
func (pm *ProtocolManager) GetProtocol(name config.Protocol) Protocol
func (*ProtocolManager) ImportProtocolGroup ¶
func (pm *ProtocolManager) ImportProtocolGroup(pg config.ProtocolGroup) error
Called after RegisterProtocol, or will see error upon unknown protocol
func (*ProtocolManager) RegisterProtocol ¶
func (pm *ProtocolManager) RegisterProtocol(p Protocol)
Called before ImportProtocolGroup, or will see error upon unknown protocol
Click to show internal directories.
Click to hide internal directories.