plugins

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: Apache-2.0 Imports: 3 Imported by: 120

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Plugins = make(map[Protocol][]Plugin)

Functions

func RegisterPlugin

func RegisterPlugin(p Plugin)

This function must not be run concurrently. This function should only be run once per plugin.

Types

type Plugin

type Plugin interface {
	// If the PluginResults != nil, and error == nil the service was found
	// If the PluginResults == nil, and error == nil the service was not found
	// If the PluginResults == nil, and error != nil an error was encountered while looking for the plugin
	// Never return both PluginResults and error as not nil
	Run(net.Conn, PluginConfig) (*PluginResults, error)
	PortPriority(uint16) bool
	Name() string
	Type() Protocol
	Priority() int
}

type PluginConfig

type PluginConfig struct {
	Timeout time.Duration
}

type PluginExtended

type PluginExtended interface {
	Plugin

	// Return true if the dst port must be skipped
	PortReject(uint16) bool

	// Return 0 if any src port is allowed
	SrcPort() uint16

	SupportedIPVersion() SupportedIPVersion
}

type PluginID

type PluginID struct {
	// contains filtered or unexported fields
}

Used as a key for maps to plugins. i.e.: map[Service] Plugin

func CreatePluginID

func CreatePluginID(p Plugin) PluginID

func (PluginID) String

func (p PluginID) String() string

type PluginResults

type PluginResults struct {
	Info map[string]any
}

type Protocol

type Protocol uint64
const (
	IP Protocol = iota + 1
	UDP
	TCP
	TCPTLS
)

func (Protocol) String

func (p Protocol) String() (s string)

type SupportedIPVersion

type SupportedIPVersion uint64
const (
	IPv4 SupportedIPVersion = 1 << iota
	IPv6
)

Jump to

Keyboard shortcuts

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