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 inputs the rules to be used by the protocol.
// Note the rules are out-of-order.
// TODO: Input in-order rules instead of out-of-order rules. May need something other than a map.
// Protocol implementations should make sure the CATCHEALL rule is always the last rule to be applied.
ApplyRules(rules []config.Rule) error // Apply rules to the protocol for later Identify()
// 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 identify a rule
}
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.