Documentation ¶
Index ¶
- type Flow
- type NFQueueLoadBalancer
- type Option
- type Service
- func (s *Service) AddFlow(ctx context.Context, flowToAdd Flow) error
- func (s *Service) AddTarget(ctx context.Context, ips []string, identifier int) error
- func (s *Service) DeleteFlow(ctx context.Context, flowToDelete Flow) error
- func (s *Service) DeleteTarget(ctx context.Context, ips []string, identifier int) error
- type ServiceOption
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 WithNFQLBPath ¶
WithNFQLBPath sets the path to the nfqlb binary.
func WithStartingOffset ¶
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) AddTarget ¶
AddTarget adds a target identifier to the nfqlb service and configures the policy route associated.
func (*Service) DeleteFlow ¶
DeleteFlow adds a Flow selecting the associated nfqlb service.
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.