Documentation ¶
Overview ¶
Package plugin contains the structs and logic to handle arbitrary transforms or management of incoming/outgoing packets.
Currently supported plugin types:
- Compression
- Encryption
Index ¶
Constants ¶
const ( // CompressionPlugin configures and injects a compression based plugin. CompressionPlugin = "compression" // EncryptionPlugin configures and injects an encryption based plugin. EncryptionPlugin = "encryption" // MockPlugin configures and injects a mock plugin for testing. MockPlugin = "mock" )
const ( // CompressionPluginOrder is the location of the compression plugin in the overall plugins enabled within quantum. CompressionPluginOrder = iota // EncryptionPluginOrder is the location of the encryption plugin in the overall plugins enabled within quantum. EncryptionPluginOrder // MockPluginOrder is the location of the mock plugin in the overall plugins enabled within quantum. MockPluginOrder )
const ( // Incoming a packet is coming from a remote node destined for the local node. Incoming = iota // Outgoing a packet is coming from the local node destined for a remote node. Outgoing )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compression ¶
type Compression struct {
// contains filtered or unexported fields
}
Compression plugin struct to use for compressing outgoing packets or decompressing incoming packets.
func (*Compression) Apply ¶
func (comp *Compression) Apply(direction Direction, payload *common.Payload, mapping *common.Mapping) (*common.Payload, *common.Mapping, bool)
Apply returns the payload/mapping compressed if the direction is Outgoing and decompressed if the direction is Incoming.
func (*Compression) Order ¶
func (comp *Compression) Order() int
Order returns the CompressionPluginOrder value.
type Direction ¶
type Direction int
Direction of the packet when supplied to the plugin in question.
type Encryption ¶
type Encryption struct {
// contains filtered or unexported fields
}
Encryption plugin struct to use for encrypting outgoing packets or decrypting incoming packets.
func (*Encryption) Apply ¶
func (enc *Encryption) Apply(direction Direction, payload *common.Payload, mapping *common.Mapping) (*common.Payload, *common.Mapping, bool)
Apply returns the payload/mapping encrypted if the direction is Outgoing and decrypted if the direction is Incoming.
func (*Encryption) Order ¶
func (enc *Encryption) Order() int
Order returns the EncryptionPluginOrder value.
type Mock ¶
type Mock struct { }
Mock plugin struct to use for testing.
type Plugin ¶
type Plugin interface { // Apply should apply the plugin to the specified payload and mapping. Apply(direction Direction, payload *common.Payload, mapping *common.Mapping) (*common.Payload, *common.Mapping, bool) // Close should gracefully destroy the plugin. Close() error // Name should return the name of the plugin. Name() string // Order returns the location of the specified plugin in the overall plugins enabled within quantum. Order() int }
Plugin interface for a generic multi-queue network device.