nfqlb

package
v0.0.0-...-97a9278 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Flow

type Flow interface {
	// Name of the flow
	GetName() string
	// Source CIDRs allowed in the flow
	// e.g.: ["124.0.0.0/24", "2001::/32"
	GetSourceCIDRs() []string
	// Destination CIDRs allowed in the flow
	// e.g.: ["124.0.0.0/24", "2001::/32"
	GetDestinationCIDRs() []string
	// Source port ranges allowed in the flow
	// e.g.: ["35000-35500", "40000"]
	GetSourcePortRanges() []string
	// Destination port ranges allowed in the flow
	// e.g.: ["35000-35500", "40000"]
	GetDestinationPortRanges() []string
	// Protocols allowed
	// e.g.: ["tcp", "udp"]
	GetProtocols() []string
	// Priority of the flow
	GetPriority() int32
	// Bytes in L4 header
	GetByteMatches() []string
}

Flow is the interface that wraps the basic Flow method.

type NFQueueLoadBalancer

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

nfqlb represents a ndqlb process with its related configuration (netfiler + routing).

func New

func New(options ...Option) (*NFQueueLoadBalancer, error)

New instantiates a NFQLB struct and configure netfiler for the nfqlb process.

func (*NFQueueLoadBalancer) AddService

func (nfqlb *NFQueueLoadBalancer) AddService(ctx context.Context,
	name string,
	options ...ServiceOption,
) (*Service, error)

AddService adds a nfqlb service.

func (*NFQueueLoadBalancer) DeleteService

func (nfqlb *NFQueueLoadBalancer) DeleteService(ctx context.Context, name string) error

DeleteService deletes a nfqlb service and all related configuration (targets and flows).

func (*NFQueueLoadBalancer) Start

func (nfqlb *NFQueueLoadBalancer) Start(ctx context.Context) error

Start nfqlb process in 'flowlb' mode supporting multiple shared mem lbs at once https://github.com/Nordix/nfqueue-loadbalancer/blob/1.1.4/src/nfqlb/cmdFlowLb.c#L238 (Returned context gets cancelled when nfqlb process stops for whatever reason)

Note: nfqlb process is supposed to run while the load-balancer container is alive and vice versa, thus there's no need for a Stop() function.

type Option

type Option func(*nfqlbConfig)

Option applies a configuration option value to nfqlb.

func WithFanout

func WithFanout(fanout bool) Option

WithFanout sets the queue fanout option.

func WithNFQLBPath

func WithNFQLBPath(nfqlbPath string) Option

WithNFQLBPath sets the path to the nfqlb binary.

func WithQLength

func WithQLength(qlength uint) Option

WithQLength sets the queue length.

func WithQueue

func WithQueue(queue string) Option

WithQueue specifies the queue(s) nfqlb will use.

func WithStartingOffset

func WithStartingOffset(startingOffset int) Option

WithStartingOffset sets the starting offset for the fowarding mark to avoid collisions with existing routing tables.

type Service

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

Service represents a nfqlb service instantiated with nfqlb init.

func (*Service) AddFlow

func (s *Service) AddFlow(ctx context.Context, flowToAdd Flow) error

AddFlow adds/updates a Flow selecting the associated nfqlb service.

func (*Service) AddTarget

func (s *Service) AddTarget(ctx context.Context, ips []string, identifier int) error

AddTarget adds a target identifier to the nfqlb service and configures the policy route associated.

func (*Service) DeleteFlow

func (s *Service) DeleteFlow(ctx context.Context, flowToDelete Flow) error

DeleteFlow adds a Flow selecting the associated nfqlb service.

func (*Service) DeleteTarget

func (s *Service) DeleteTarget(ctx context.Context, ips []string, identifier int) error

DeleteTarget deletes a target identifier to the nfqlb service and deletes the policy route associated.

type ServiceOption

type ServiceOption func(*nfqlbServiceConfig)

ServiceOption applies a configuration option value to a nfqlb service.

func WithMaxTargets

func WithMaxTargets(maxTargets int) ServiceOption

WithQLength sets the queue length.

Jump to

Keyboard shortcuts

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