types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Action type
	ActionTypeGeneric ActionType = "gact"

	// Generic control actions
	ActionGenericPass ActionGenericType = "pass"
	ActionGenericDrop ActionGenericType = "drop"
)
View Source
const (
	// ChainDefaultParent is the default parent of a chain which is the ingress qdisc
	ChainDefaultParent uint32 = 0xfffffff1
	// ChainDefaultChain is the default chain number
	ChainDefaultChain uint16 = 0
)
View Source
const (
	// Values for FilterAttrs.Protocol
	FilterProtocolAll   FilterProtocol = "all"
	FilterProtocolIPv4  FilterProtocol = "ip"
	FilterProtocolIPv6  FilterProtocol = "ipv6"
	FilterProtocol8021Q FilterProtocol = "802.1q"

	// FlowerFilter.Kind
	FilterKindFlower FilterKind = "flower"

	// FlowerKeys
	FlowerKeyIPProto     FlowerKey = "ip_proto"
	FlowerKeyDstIP       FlowerKey = "dst_ip"
	FlowerKeyDstPort     FlowerKey = "dst_port"
	FlowerKeyVlanEthType FlowerKey = "vlan_ethtype"

	// FlowerFilter.Flower.IPProto
	FlowerIPProtoTCP FlowerIPProto = "tcp"
	FlowerIPProtoUDP FlowerIPProto = "udp"

	// FlowerFilter.Flower.VlanEthType
	FlowerVlanEthTypeIPv4 FlowerVlanEthType = "ip"
	FlowerVlanEthTypeIPv6 FlowerVlanEthType = "ipv6"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action interface {
	// Type returns the action type
	Type() ActionType
	// Spec returns Action Specification
	Spec() map[string]string
	// Equals compares this Action with other, returns true if they are equal or false otherwise
	Equals(other Action) bool

	// Driver Specific related Interfaces
	CmdLineGenerator
}

Action is an interface which represents a TC action

type ActionGenericType

type ActionGenericType string

ActionGenericType is the Generic Action control action type

type ActionType

type ActionType string

ActionType is the TC Action type

type Chain

type Chain interface {
	// Attrs returns chain attributes
	Attrs() *ChainAttrs

	// Driver Specific related Interfaces
	CmdLineGenerator
}

Chain is an interface which represents a TC chain

type ChainAttrs

type ChainAttrs struct {
	Parent *uint32
	Chain  *uint16
}

ChainAttrs are the attributes of a Chain

type ChainBuilder

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

ChainBuilder is a Chain builder

func NewChainBuilder

func NewChainBuilder() *ChainBuilder

NewChainBuilder creates a new ChainBuilder

func (*ChainBuilder) Build

func (cb *ChainBuilder) Build() *ChainImpl

Build builds and returns a new Chain instance Note: calling Build() multiple times will not return a completely new object on each call. that is, pointer/slice/map types will not be deep copied. to create several objects, different builders should be used.

func (*ChainBuilder) WithChain

func (cb *ChainBuilder) WithChain(chain uint16) *ChainBuilder

WithChain adds Chain chain number to ChainBuilder

func (*ChainBuilder) WithParent

func (cb *ChainBuilder) WithParent(parent uint32) *ChainBuilder

WithParent adds Chain Parent to ChainBuilder

type ChainImpl

type ChainImpl struct {
	ChainAttrs
}

ChainImpl is a concrete implementation of Chain

func NewChainImpl

func NewChainImpl(parent *uint32, chain *uint16) *ChainImpl

func (*ChainImpl) Attrs

func (c *ChainImpl) Attrs() *ChainAttrs

Attrs implements Chain interface

func (*ChainImpl) GenCmdLineArgs

func (c *ChainImpl) GenCmdLineArgs() []string

GenCmdLineArgs implements CmdLineGenerator interface

type CmdLineGenerator

type CmdLineGenerator interface {
	// GenCmdLineArgs returns tc command line arguments which can be incorporated
	// when invoking tc command via shell
	GenCmdLineArgs() []string
}

CmdLineGenerator is an interface for generating tc command line args for a tc object

type Filter

type Filter interface {
	// Attrs returns FilterAttrs
	Attrs() *FilterAttrs
	// Equals compares this Filter with other, returns true if they are equal or false otherwise
	Equals(other Filter) bool

	// Driver Specific related Interfaces
	CmdLineGenerator
}

Filter represent a tc filter object

type FilterAttrs

type FilterAttrs struct {
	Kind     FilterKind
	Protocol FilterProtocol
	Chain    *uint16
	Handle   *uint32
	Priority *uint16
}

FilterAttrs holds filter object attributes

func NewFilterAttrs

func NewFilterAttrs(
	kind FilterKind, protocol FilterProtocol, chain *uint16, handle *uint32, priority *uint16) *FilterAttrs

NewFilterAttrs creates new FilterAttrs instance

func (*FilterAttrs) Equals

func (fa *FilterAttrs) Equals(other *FilterAttrs) bool

Equals compares this FilterAttrs with other, returns true if they are equal or false otherwise

func (*FilterAttrs) GenCmdLineArgs

func (fa *FilterAttrs) GenCmdLineArgs() []string

GenCmdLineArgs implements CmdLineGenerator interface, it generates the needed tc command line args for FilterAttrs

type FilterAttrsBuilder

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

FilterAttrsBuilder is a FilterAttr builder

func NewFilterAttrsBuilder

func NewFilterAttrsBuilder() *FilterAttrsBuilder

NewFilterAttrsBuilder returns a new FilterAttrsBuilder

func (*FilterAttrsBuilder) Build

func (fb *FilterAttrsBuilder) Build() *FilterAttrs

Build builds and returns a new FilterAttrs instance Note: calling Build() multiple times will not return a completely new object on each call. that is, pointer/slice/map types will not be deep copied. to create several objects, different builders should be used.

func (*FilterAttrsBuilder) WithChain

func (fb *FilterAttrsBuilder) WithChain(c uint16) *FilterAttrsBuilder

WithChain adds Chain index to FilterAttrsBuilder

func (*FilterAttrsBuilder) WithHandle

func (fb *FilterAttrsBuilder) WithHandle(h uint32) *FilterAttrsBuilder

WithHandle adds Handle to FilterAttrsBuilder

func (*FilterAttrsBuilder) WithKind

WithKind adds Kind to FilterAttrsBuilder

func (*FilterAttrsBuilder) WithPriority

func (fb *FilterAttrsBuilder) WithPriority(p uint16) *FilterAttrsBuilder

WithPriority adds Priority to FilterAttrsBuilder

func (*FilterAttrsBuilder) WithProtocol

WithProtocol adds Protocol to FilterAttrsBuilder

type FilterKind

type FilterKind string

FilterKind is the type of filter

type FilterProtocol

type FilterProtocol string

FilterProtocol is the type of filter protocol

type FlowerFilter

type FlowerFilter struct {
	FilterAttrs
	// Flower Match keys, only valid if Kind == FilterKindFlower
	Flower *FlowerSpec
	// Actions
	Actions []Action
}

FlowerFilter is a concrete implementation of Filter of kind Flower

func (*FlowerFilter) Attrs

func (f *FlowerFilter) Attrs() *FilterAttrs

Attrs implements Filter interface, it returns FilterAttrs

func (*FlowerFilter) Equals

func (f *FlowerFilter) Equals(other Filter) bool

Equals implements Filter interface

func (*FlowerFilter) GenCmdLineArgs

func (f *FlowerFilter) GenCmdLineArgs() []string

GenCmdLineArgs implements CmdLineGenerator interface, it generates the needed tc command line args for FlowerFilter

type FlowerFilterBuilder

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

FlowerFilterBuilder is a FlowerFilter builder

func NewFlowerFilterBuilder

func NewFlowerFilterBuilder() *FlowerFilterBuilder

NewFlowerFilterBuilder returns a new instance of FlowerFilterBuilder

func (*FlowerFilterBuilder) Build

func (fb *FlowerFilterBuilder) Build() *FlowerFilter

Build builds and creates a new FlowerFilter instance Note: calling Build() multiple times will not return a completely new object on each call. that is, pointer/slice/map types will not be deep copied. to create several objects, different builders should be used.

func (*FlowerFilterBuilder) WithAction

func (fb *FlowerFilterBuilder) WithAction(a Action) *FlowerFilterBuilder

WithAction adds specified Action to FlowerFilterBuilder

func (*FlowerFilterBuilder) WithChain

WithChain adds Chain number to FlowerFilterBuilder

func (*FlowerFilterBuilder) WithHandle

func (fb *FlowerFilterBuilder) WithHandle(h uint32) *FlowerFilterBuilder

WithHandle adds Handle to FlowerFilterBuilder

func (*FlowerFilterBuilder) WithKind

WithKind adds Kind to FlowerFilterBuilder

func (*FlowerFilterBuilder) WithMatchKeyDstIP

func (fb *FlowerFilterBuilder) WithMatchKeyDstIP(val string) *FlowerFilterBuilder

WithMatchKeyDstIP adds Match with FlowerKeyDstIP key and specified value to FlowerFilterBuilder

func (*FlowerFilterBuilder) WithMatchKeyDstPort

func (fb *FlowerFilterBuilder) WithMatchKeyDstPort(val uint16) *FlowerFilterBuilder

WithMatchKeyDstPort adds Match with FlowerKeyDstPort key and specified value to FlowerFilterBuilder

func (*FlowerFilterBuilder) WithMatchKeyIPProto

func (fb *FlowerFilterBuilder) WithMatchKeyIPProto(val FlowerIPProto) *FlowerFilterBuilder

WithMatchKeyIPProto adds Match with FlowerKeyIPProto key and specified value to FlowerFilterBuilder

func (*FlowerFilterBuilder) WithMatchKeyVlanEthType

func (fb *FlowerFilterBuilder) WithMatchKeyVlanEthType(val FlowerVlanEthType) *FlowerFilterBuilder

WithMatchKeyVlanEthType adds Match with FlowerKeyVlanEthType key and specified value to FlowerFilterBuilder

func (*FlowerFilterBuilder) WithPriority

func (fb *FlowerFilterBuilder) WithPriority(p uint16) *FlowerFilterBuilder

WithPriority adds Priority to FlowerFilterBuilder

func (*FlowerFilterBuilder) WithProtocol

WithProtocol adds Protocol to FlowerFilterBuilder

type FlowerIPProto

type FlowerIPProto string

FlowerIPProto is the type of IPProto flower key

func PortProtocolToFlowerIPProto

func PortProtocolToFlowerIPProto(proto policyrules.PolicyPortProtocol) FlowerIPProto

PortProtocolToFlowerIPProto converts policyrules.PolicyPortProtocol to FlowerIPProto, returns "" if conversion is invalid.

type FlowerKey

type FlowerKey string

FlowerKey is the type of flower key

type FlowerSpec

type FlowerSpec struct {
	VlanEthType *FlowerVlanEthType
	IPProto     *FlowerIPProto
	DstIP       *string
	DstPort     *uint16
}

FlowerSpec holds flower filter specification (which consists of a list of Match)

func (*FlowerSpec) Equals

func (ff *FlowerSpec) Equals(other *FlowerSpec) bool

Equals compares this FlowerSpec with other, returns true if they are equal or false otherwise

func (*FlowerSpec) GenCmdLineArgs

func (ff *FlowerSpec) GenCmdLineArgs() []string

GenCmdLineArgs implements CmdLineGenerator interface, it generates the needed tc command line args for FlowerSpec

type FlowerVlanEthType

type FlowerVlanEthType string

FlowerVlanEthType is the type of VlanEthType flower key

func ProtoToFlowerVlanEthType

func ProtoToFlowerVlanEthType(proto FilterProtocol) FlowerVlanEthType

ProtoToFlowerVlanEthType converts FilterProtocol to FlowerVlanEthType, returns "" if conversion is invalid.

type GenericAction

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

GenericAction is a struct representing TC generic action (gact)

func NewGenericAction

func NewGenericAction(controlAction ActionGenericType) *GenericAction

NewGenericAction creates a new GenericAction

func (*GenericAction) Equals

func (a *GenericAction) Equals(other Action) bool

Equals implements Action interface, it returns true if this and other Action are equal

func (*GenericAction) GenCmdLineArgs

func (a *GenericAction) GenCmdLineArgs() []string

GenCmdLineArgs implements CmdLineGenerator interface

func (*GenericAction) Spec

func (a *GenericAction) Spec() map[string]string

Spec implements Action interface, it returns the specification of the action

func (*GenericAction) Type

func (a *GenericAction) Type() ActionType

Type implements Action interface, it returns the type of the action

type GenericActionBuilder

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

GenericActionBuilder is a GenericAction builer

func NewGenericActionBuiler

func NewGenericActionBuiler() *GenericActionBuilder

NewGenericActionBuiler creates a new GenericActionBuilder

func (*GenericActionBuilder) Build

func (gb *GenericActionBuilder) Build() *GenericAction

Build builds and returns a new GenericAction instance

func (*GenericActionBuilder) WithDrop

WithDrop adds ActionGenericDrop control action to GenericActionBuilder

func (*GenericActionBuilder) WithPass

WithPass adds ActionGenericPass control action to GenericActionBuilder

type GenericQDisc

type GenericQDisc struct {
	QDiscAttrs
	QdiscType QDiscType
}

GenericQDisc is a generic qdisc of an arbitrary type

func NewGenericQdisc

func NewGenericQdisc(qDiscAttrs *QDiscAttrs, qType QDiscType) *GenericQDisc

NewGenericQdisc creates a new Generic QDisc object

func (*GenericQDisc) Attrs

func (g *GenericQDisc) Attrs() *QDiscAttrs

Attrs implements QDisc interface

func (*GenericQDisc) GenCmdLineArgs

func (g *GenericQDisc) GenCmdLineArgs() []string

GenCmdLineArgs implements CmdLineGenerator interface

func (*GenericQDisc) Type

func (g *GenericQDisc) Type() QDiscType

Type implements QDisc interface

type IngressQDiscBuilder

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

IngressQDiscBuilder is an IngressQDisc builder

func NewIngressQDiscBuilder

func NewIngressQDiscBuilder() *IngressQDiscBuilder

NewIngressQDiscBuilder returns a new NewIngressQDiscBuilder

func (*IngressQDiscBuilder) Build

func (iqb *IngressQDiscBuilder) Build() *GenericQDisc

Build builds and returns a new GenericQDisc instance of type QDiscIngressType Note: calling Build() multiple times will not return a completely new object on each call. that is, pointer/slice/map types will not be deep copied. to create several objects, different builders should be used.

func (*IngressQDiscBuilder) WithHandle

func (iqb *IngressQDiscBuilder) WithHandle(h uint32) *IngressQDiscBuilder

WithHandle adds Handle to IngressQDiscBuilder

func (*IngressQDiscBuilder) WithParent

func (iqb *IngressQDiscBuilder) WithParent(p uint32) *IngressQDiscBuilder

WithParent adds Parent to IngressQDiscBuilder

type QDisc

type QDisc interface {
	// Attrs returns QDiscAttrs for a qdisc
	Attrs() *QDiscAttrs
	// Type returns the QDisc type
	Type() QDiscType

	// Driver Specific related Interfaces
	CmdLineGenerator
}

QDisc is an interface which represents a TC qdisc object

type QDiscAttrs

type QDiscAttrs struct {
	Parent *uint32
	Handle *uint32
}

QDiscAttrs holds QDisc object attributes

func NewQDiscAttrs

func NewQDiscAttrs(parent, handle *uint32) *QDiscAttrs

NewQDiscAttrs creates new QDiscAttrs instance

type QDiscAttrsBuilder

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

QDiscAttrsBuilder is a QDiscAttrs builder

func NewQDiscAttrsBuilder

func NewQDiscAttrsBuilder() *QDiscAttrsBuilder

NewQDiscAttrsBuilder returns a new QDiscAttrsBuilder

func (*QDiscAttrsBuilder) Build

func (qb *QDiscAttrsBuilder) Build() *QDiscAttrs

Build builds and returns a new QDiscAttrs instance Note: calling Build() multiple times will not return a completely new object on each call. that is, pointer/slice/map types will not be deep copied. to create several objects, different builders should be used.

func (*QDiscAttrsBuilder) WithHandle

func (qb *QDiscAttrsBuilder) WithHandle(h uint32) *QDiscAttrsBuilder

WithHandle adds Handle to QDiscAttrsBuilder

func (*QDiscAttrsBuilder) WithParent

func (qb *QDiscAttrsBuilder) WithParent(p uint32) *QDiscAttrsBuilder

WithParent adds Parent to QDiscAttrsBuilder

type QDiscType

type QDiscType string

QDiscType is the type of qdisc

const (
	QDiscIngressType QDiscType = "ingress"
)

Jump to

Keyboard shortcuts

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