Documentation
¶
Index ¶
- Constants
- Variables
- func NewAffinityMatchMap(maxEntries int) *bpf.Map
- func NewBackend4Map(maxEntries int) *bpf.Map
- func NewBackend6Map(maxEntries int) *bpf.Map
- func NewMaglevInnerMapSpec(tableSize uint) *ebpf.MapSpec
- func NewMaglevOuterMap(name string, maxEntries int, innerSpec *ebpf.MapSpec) *bpf.Map
- func NewRevNat4Map(maxEntries int) *bpf.Map
- func NewRevNat6Map(maxEntries int) *bpf.Map
- func NewService4Map(maxEntries int) *bpf.Map
- func NewService6Map(maxEntries int) *bpf.Map
- func NewSockRevNat4Map(maxEntries int) *bpf.Map
- func NewSockRevNat6Map(maxEntries int) *bpf.Map
- func NewSourceRange4Map(maxEntries int) *bpf.Map
- func NewSourceRange6Map(maxEntries int) *bpf.Map
- type Affinity4Key
- type Affinity6Key
- type AffinityMatchKey
- type AffinityMatchValue
- type AffinityValue
- type BPFLBMaps
- func (r *BPFLBMaps) DeleteAffinityMatch(key *AffinityMatchKey) error
- func (r *BPFLBMaps) DeleteBackend(key BackendKey) error
- func (r *BPFLBMaps) DeleteMaglev(key MaglevOuterKey, ipv6 bool) error
- func (r *BPFLBMaps) DeleteRevNat(key RevNatKey) error
- func (r *BPFLBMaps) DeleteService(key ServiceKey) error
- func (r *BPFLBMaps) DeleteSockRevNat(cookie uint64, addr net.IP, port uint16) error
- func (r *BPFLBMaps) DeleteSourceRange(key SourceRangeKey) error
- func (r *BPFLBMaps) DumpAffinityMatch(cb func(*AffinityMatchKey, *AffinityMatchValue)) error
- func (r *BPFLBMaps) DumpBackend(cb func(BackendKey, BackendValue)) error
- func (r *BPFLBMaps) DumpMaglev(cb func(MaglevOuterKey, MaglevOuterVal, MaglevInnerKey, *MaglevInnerVal, bool)) error
- func (r *BPFLBMaps) DumpRevNat(cb func(RevNatKey, RevNatValue)) error
- func (r *BPFLBMaps) DumpService(cb func(ServiceKey, ServiceValue)) error
- func (r *BPFLBMaps) DumpSourceRange(cb func(SourceRangeKey, *SourceRangeValue)) error
- func (r *BPFLBMaps) ExistsSockRevNat(cookie uint64, addr net.IP, port uint16) bool
- func (r *BPFLBMaps) IsEmpty() bool
- func (r *BPFLBMaps) LookupBackend(key BackendKey) (val BackendValue, err error)
- func (r *BPFLBMaps) Start(ctx cell.HookContext) (err error)
- func (r *BPFLBMaps) Stop(cell.HookContext) error
- func (r *BPFLBMaps) UpdateAffinityMatch(key *AffinityMatchKey, value *AffinityMatchValue) error
- func (r *BPFLBMaps) UpdateBackend(key BackendKey, value BackendValue) error
- func (r *BPFLBMaps) UpdateMaglev(key MaglevOuterKey, backendIDs []loadbalancer.BackendID, ipv6 bool) error
- func (r *BPFLBMaps) UpdateRevNat(key RevNatKey, value RevNatValue) error
- func (r *BPFLBMaps) UpdateService(key ServiceKey, value ServiceValue) error
- func (r *BPFLBMaps) UpdateSockRevNat(cookie uint64, addr net.IP, port uint16, revNatIndex uint16) error
- func (r *BPFLBMaps) UpdateSourceRange(key SourceRangeKey, value *SourceRangeValue) error
- type Backend
- type Backend4KeyV3
- type Backend4V3
- type Backend4ValueV3
- func (b *Backend4ValueV3) GetAddress() cmtypes.AddrCluster
- func (b *Backend4ValueV3) GetFlags() uint8
- func (b *Backend4ValueV3) GetPort() uint16
- func (b *Backend4ValueV3) GetProtocol() uint8
- func (b *Backend4ValueV3) GetZone() uint8
- func (b *Backend4ValueV3) New() bpf.MapValue
- func (v *Backend4ValueV3) String() string
- func (v *Backend4ValueV3) ToHost() BackendValue
- func (v *Backend4ValueV3) ToNetwork() BackendValue
- type Backend6KeyV3
- type Backend6V3
- type Backend6ValueV3
- func (b *Backend6ValueV3) GetAddress() cmtypes.AddrCluster
- func (b *Backend6ValueV3) GetFlags() uint8
- func (b *Backend6ValueV3) GetPort() uint16
- func (b *Backend6ValueV3) GetProtocol() uint8
- func (b *Backend6ValueV3) GetZone() uint8
- func (v *Backend6ValueV3) New() bpf.MapValue
- func (v *Backend6ValueV3) String() string
- func (v *Backend6ValueV3) ToHost() BackendValue
- func (v *Backend6ValueV3) ToNetwork() BackendValue
- type BackendKey
- type BackendValue
- type FakeLBMaps
- func (f *FakeLBMaps) DeleteAffinityMatch(key *AffinityMatchKey) error
- func (f *FakeLBMaps) DeleteBackend(key BackendKey) error
- func (f *FakeLBMaps) DeleteMaglev(key MaglevOuterKey, ipv6 bool) error
- func (f *FakeLBMaps) DeleteRevNat(key RevNatKey) error
- func (f *FakeLBMaps) DeleteService(key ServiceKey) error
- func (f *FakeLBMaps) DeleteSockRevNat(cookie uint64, addr net.IP, port uint16) error
- func (f *FakeLBMaps) DeleteSourceRange(key SourceRangeKey) error
- func (f *FakeLBMaps) DumpAffinityMatch(cb func(*AffinityMatchKey, *AffinityMatchValue)) error
- func (f *FakeLBMaps) DumpBackend(cb func(BackendKey, BackendValue)) error
- func (f *FakeLBMaps) DumpMaglev(cb func(MaglevOuterKey, MaglevOuterVal, MaglevInnerKey, *MaglevInnerVal, bool)) error
- func (f *FakeLBMaps) DumpRevNat(cb func(RevNatKey, RevNatValue)) error
- func (f *FakeLBMaps) DumpService(cb func(ServiceKey, ServiceValue)) error
- func (f *FakeLBMaps) DumpSourceRange(cb func(SourceRangeKey, *SourceRangeValue)) error
- func (f *FakeLBMaps) ExistsSockRevNat(cookie uint64, addr net.IP, port uint16) bool
- func (f *FakeLBMaps) IsEmpty() bool
- func (f *FakeLBMaps) LookupBackend(key BackendKey) (BackendValue, error)
- func (f *FakeLBMaps) UpdateAffinityMatch(key *AffinityMatchKey, value *AffinityMatchValue) error
- func (f *FakeLBMaps) UpdateBackend(key BackendKey, value BackendValue) error
- func (f *FakeLBMaps) UpdateMaglev(key MaglevOuterKey, backendIDs []loadbalancer.BackendID, ipv6 bool) error
- func (f *FakeLBMaps) UpdateRevNat(key RevNatKey, value RevNatValue) error
- func (f *FakeLBMaps) UpdateService(key ServiceKey, value ServiceValue) error
- func (f *FakeLBMaps) UpdateSockRevNat(cookie uint64, addr net.IP, port uint16, revNatIndex uint16) error
- func (f *FakeLBMaps) UpdateSourceRange(key SourceRangeKey, value *SourceRangeValue) error
- type FaultyLBMaps
- func (f *FaultyLBMaps) DeleteAffinityMatch(key *AffinityMatchKey) error
- func (f *FaultyLBMaps) DeleteBackend(key BackendKey) error
- func (f *FaultyLBMaps) DeleteMaglev(key MaglevOuterKey, ipv6 bool) error
- func (f *FaultyLBMaps) DeleteRevNat(key RevNatKey) error
- func (f *FaultyLBMaps) DeleteService(key ServiceKey) error
- func (f *FaultyLBMaps) DeleteSockRevNat(cookie uint64, addr net.IP, port uint16) error
- func (f *FaultyLBMaps) DeleteSourceRange(key SourceRangeKey) error
- func (f *FaultyLBMaps) DumpAffinityMatch(cb func(*AffinityMatchKey, *AffinityMatchValue)) error
- func (f *FaultyLBMaps) DumpBackend(cb func(BackendKey, BackendValue)) error
- func (f *FaultyLBMaps) DumpMaglev(cb func(MaglevOuterKey, MaglevOuterVal, MaglevInnerKey, *MaglevInnerVal, bool)) error
- func (f *FaultyLBMaps) DumpRevNat(cb func(RevNatKey, RevNatValue)) error
- func (f *FaultyLBMaps) DumpService(cb func(ServiceKey, ServiceValue)) error
- func (f *FaultyLBMaps) DumpSourceRange(cb func(SourceRangeKey, *SourceRangeValue)) error
- func (f *FaultyLBMaps) ExistsSockRevNat(cookie uint64, addr net.IP, port uint16) bool
- func (f *FaultyLBMaps) IsEmpty() bool
- func (f *FaultyLBMaps) LookupBackend(key BackendKey) (BackendValue, error)
- func (f *FaultyLBMaps) UpdateAffinityMatch(key *AffinityMatchKey, value *AffinityMatchValue) error
- func (f *FaultyLBMaps) UpdateBackend(key BackendKey, value BackendValue) error
- func (f *FaultyLBMaps) UpdateMaglev(key MaglevOuterKey, backendIDs []loadbalancer.BackendID, ipv6 bool) error
- func (f *FaultyLBMaps) UpdateRevNat(key RevNatKey, value RevNatValue) error
- func (f *FaultyLBMaps) UpdateService(key ServiceKey, value ServiceValue) error
- func (f *FaultyLBMaps) UpdateSockRevNat(cookie uint64, addr net.IP, port uint16, revNatIndex uint16) error
- func (f *FaultyLBMaps) UpdateSourceRange(key SourceRangeKey, value *SourceRangeValue) error
- type HaveNetNSCookieSupport
- type LBMaps
- type MaglevInnerKey
- type MaglevInnerMap
- type MaglevInnerVal
- type MaglevOuterKey
- type MaglevOuterVal
- type MapDump
- type RevNat4Key
- type RevNat4Value
- type RevNat6Key
- type RevNat6Value
- type RevNatKey
- type RevNatValue
- type Service4Key
- func (k *Service4Key) GetAddress() net.IP
- func (k *Service4Key) GetBackendSlot() int
- func (k *Service4Key) GetPort() uint16
- func (k *Service4Key) GetProtocol() uint8
- func (k *Service4Key) GetScope() uint8
- func (k *Service4Key) IsIPv6() bool
- func (k *Service4Key) IsSurrogate() bool
- func (k *Service4Key) New() bpf.MapKey
- func (k *Service4Key) RevNatValue() RevNatValue
- func (k *Service4Key) SetBackendSlot(slot int)
- func (k *Service4Key) SetScope(scope uint8)
- func (k *Service4Key) String() string
- func (k *Service4Key) ToHost() ServiceKey
- func (k *Service4Key) ToNetwork() ServiceKey
- type Service4Value
- func (s *Service4Value) GetBackendID() loadbalancer.BackendID
- func (s *Service4Value) GetCount() int
- func (s *Service4Value) GetFlags() uint16
- func (s *Service4Value) GetL7LBProxyPort() uint16
- func (s *Service4Value) GetLbAlg() loadbalancer.SVCLoadBalancingAlgorithm
- func (s *Service4Value) GetQCount() int
- func (s *Service4Value) GetRevNat() int
- func (s *Service4Value) GetSessionAffinityTimeoutSec() uint32
- func (s *Service4Value) New() bpf.MapValue
- func (s *Service4Value) RevNatKey() RevNatKey
- func (s *Service4Value) SetBackendID(id loadbalancer.BackendID)
- func (s *Service4Value) SetCount(count int)
- func (s *Service4Value) SetFlags(flags uint16)
- func (s *Service4Value) SetL7LBProxyPort(port uint16)
- func (s *Service4Value) SetLbAlg(lb loadbalancer.SVCLoadBalancingAlgorithm)
- func (s *Service4Value) SetQCount(count int)
- func (s *Service4Value) SetRevNat(id int)
- func (s *Service4Value) SetSessionAffinityTimeoutSec(t uint32) error
- func (s *Service4Value) String() string
- func (s *Service4Value) ToHost() ServiceValue
- func (s *Service4Value) ToNetwork() ServiceValue
- type Service6Key
- func (k *Service6Key) GetAddress() net.IP
- func (k *Service6Key) GetBackendSlot() int
- func (k *Service6Key) GetPort() uint16
- func (k *Service6Key) GetProtocol() uint8
- func (k *Service6Key) GetScope() uint8
- func (k *Service6Key) IsIPv6() bool
- func (k *Service6Key) IsSurrogate() bool
- func (k *Service6Key) New() bpf.MapKey
- func (k *Service6Key) RevNatValue() RevNatValue
- func (k *Service6Key) SetBackendSlot(slot int)
- func (k *Service6Key) SetScope(scope uint8)
- func (k *Service6Key) String() string
- func (k *Service6Key) ToHost() ServiceKey
- func (k *Service6Key) ToNetwork() ServiceKey
- type Service6Value
- func (s *Service6Value) GetBackendID() loadbalancer.BackendID
- func (s *Service6Value) GetCount() int
- func (s *Service6Value) GetFlags() uint16
- func (s *Service6Value) GetL7LBProxyPort() uint16
- func (s *Service6Value) GetLbAlg() loadbalancer.SVCLoadBalancingAlgorithm
- func (s *Service6Value) GetQCount() int
- func (s *Service6Value) GetRevNat() int
- func (s *Service6Value) GetSessionAffinityTimeoutSec() uint32
- func (s *Service6Value) New() bpf.MapValue
- func (s *Service6Value) RevNatKey() RevNatKey
- func (s *Service6Value) SetBackendID(id loadbalancer.BackendID)
- func (s *Service6Value) SetCount(count int)
- func (s *Service6Value) SetFlags(flags uint16)
- func (s *Service6Value) SetL7LBProxyPort(port uint16)
- func (s *Service6Value) SetLbAlg(lb loadbalancer.SVCLoadBalancingAlgorithm)
- func (s *Service6Value) SetQCount(count int)
- func (s *Service6Value) SetRevNat(id int)
- func (s *Service6Value) SetSessionAffinityTimeoutSec(t uint32) error
- func (s *Service6Value) String() string
- func (s *Service6Value) ToHost() ServiceValue
- func (s *Service6Value) ToNetwork() ServiceValue
- type ServiceKey
- type ServiceValue
- type SkipLB4Key
- type SkipLB4Value
- type SkipLB6Key
- type SkipLB6Value
- type SkipLBMap
- type SockRevNat4Key
- type SockRevNat4Value
- type SockRevNat6Key
- type SockRevNat6Value
- type SourceRangeKey
- type SourceRangeKey4
- type SourceRangeKey6
- type SourceRangeValue
Constants ¶
const ( // Service4MapV2Name is the name of the IPv4 LB Services v2 BPF map. Service4MapV2Name = "cilium_lb4_services_v2" // Service6MapV2Name is the name of the IPv6 LB Services v2 BPF map. Service6MapV2Name = "cilium_lb6_services_v2" )
const ( // Backend4MapName is the name of the IPv4 LB backends BPF map. Backend4MapName = "cilium_lb4_backends" // Backend4MapV2Name is the name of the IPv4 LB backends v2 BPF map. Backend4MapV2Name = "cilium_lb4_backends_v2" // Backend4MapV3Name is the name of the IPv4 LB backends v3 BPF map. Backend4MapV3Name = "cilium_lb4_backends_v3" // Backend6MapName is the name of the IPv6 LB backends BPF map. Backend6MapName = "cilium_lb6_backends" // Backend6MapV2Name is the name of the IPv6 LB backends v2 BPF map. Backend6MapV2Name = "cilium_lb6_backends_v2" // Backend6MapV3Name is the name of the IPv6 LB backends v3 BPF map. Backend6MapV3Name = "cilium_lb6_backends_v3" )
const ( // RevNat4MapName is the name of the IPv4 LB reverse NAT BPF map. RevNat4MapName = "cilium_lb4_reverse_nat" // RevNat6MapName is the name of the IPv6 LB reverse NAT BPF map. RevNat6MapName = "cilium_lb6_reverse_nat" )
const ( AffinityMatchMapName = "cilium_lb_affinity_match" Affinity4MapName = "cilium_lb4_affinity" Affinity6MapName = "cilium_lb6_affinity" )
const ( // SockRevNat4MapName is the BPF map name. SockRevNat4MapName = "cilium_lb4_reverse_sk" // SockRevNat6MapName is the BPF map name. SockRevNat6MapName = "cilium_lb6_reverse_sk" // SockRevNat4MapSize is the maximum number of entries in the BPF map. SockRevNat4MapSize = 256 * 1024 // SockRevNat6MapSize is the maximum number of entries in the BPF map. SockRevNat6MapSize = 256 * 1024 // MaxSockRevNat4MapEntries is the maximum number of entries in the BPF // map. It is set by Init(), but unit tests use the initial value below. MaxSockRevNat4MapEntries = SockRevNat4MapSize // MaxSockRevNat6MapEntries is the maximum number of entries in the BPF // map. It is set by Init(), but unit tests use the initial value below. MaxSockRevNat6MapEntries = SockRevNat6MapSize )
const ( // Both outer maps are pinned though given we need to insert // inner maps into them. MaglevOuter4MapName = "cilium_lb4_maglev" MaglevOuter6MapName = "cilium_lb6_maglev" MaglevInnerMapName = "cilium_maglev_inner" )
const ( SourceRange4MapName = "cilium_lb4_source_range" SourceRange6MapName = "cilium_lb6_source_range" )
const ( // HealthProbe4MapName is the health datapath map name HealthProbe4MapName = "cilium_lb4_health" // HealthProbe6MapName is the health datapath map name HealthProbe6MapName = "cilium_lb6_health" )
const ( // SkipLB4MapName is the name of the IPv4 BPF map that stores entries to skip LB. SkipLB4MapName = "cilium_skip_lb4" // SkipLB6MapName is the name of the IPv6 BPF map that stores entries to skip LB. SkipLB6MapName = "cilium_skip_lb6" // SkipLBMapMaxEntries is the maximum number of entries in the skip LB BPF maps. SkipLBMapMaxEntries = 100 )
const SizeofSockRevNat6Key = int(unsafe.Sizeof(SockRevNat6Key{}))
SizeofSockRevNat6Key is the size of type SockRevNat6Key.
const SizeofSockRevNat6Value = int(unsafe.Sizeof(SockRevNat6Value{}))
SizeofSockRevNat6Value is the size of type SockRevNat6Value.
Variables ¶
var Cell = cell.Module( "loadbalancer-maps", "Load-balancing BPF maps", cell.Provide(newLBMaps), cell.Provide(scriptCommands), cell.Provide(NetnsCookieSupportFunc), cell.Invoke(registerPressureMetricsReporter), )
Provides [LBMap] a wrapper around the load-balancing BPF maps
var MaglevBackendLen = uint32(unsafe.Sizeof(loadbalancer.BackendID(0)))
MaglevBackendLen represents the length of a single backend ID in a Maglev lookup table.
Functions ¶
func NewAffinityMatchMap ¶
func NewBackend4Map ¶
func NewBackend6Map ¶
func NewMaglevInnerMapSpec ¶
func NewMaglevOuterMap ¶
func NewRevNat4Map ¶
func NewRevNat6Map ¶
func NewService4Map ¶
func NewService6Map ¶
func NewSockRevNat4Map ¶
func NewSockRevNat6Map ¶
func NewSourceRange4Map ¶
func NewSourceRange6Map ¶
Types ¶
type Affinity4Key ¶
type Affinity4Key struct {
ClientID uint64 `align:"client_id"`
RevNATID uint16 `align:"rev_nat_id"`
NetNSCookie uint8 `align:"netns_cookie"`
Pad1 uint8 `align:"pad1"`
Pad2 uint32 `align:"pad2"`
}
Affinity4Key is the Go representation of lb4_affinity_key
func (*Affinity4Key) New ¶
func (k *Affinity4Key) New() bpf.MapKey
func (*Affinity4Key) String ¶
func (k *Affinity4Key) String() string
String converts the key into a human readable string format.
type Affinity6Key ¶
type Affinity6Key struct {
ClientID types.IPv6 `align:"client_id"`
RevNATID uint16 `align:"rev_nat_id"`
NetNSCookie uint8 `align:"netns_cookie"`
Pad1 uint8 `align:"pad1"`
Pad2 uint32 `align:"pad2"`
}
Affinity6Key is the Go representation of lb6_affinity_key
func (*Affinity6Key) New ¶
func (k *Affinity6Key) New() bpf.MapKey
func (*Affinity6Key) String ¶
func (k *Affinity6Key) String() string
String converts the key into a human readable string format.
type AffinityMatchKey ¶
type AffinityMatchKey struct {
BackendID loadbalancer.BackendID `align:"backend_id"`
RevNATID uint16 `align:"rev_nat_id"`
Pad uint16 `align:"pad"`
}
func (*AffinityMatchKey) New ¶
func (k *AffinityMatchKey) New() bpf.MapKey
func (*AffinityMatchKey) String ¶
func (k *AffinityMatchKey) String() string
String converts the key into a human readable string format
func (*AffinityMatchKey) ToHost ¶
func (k *AffinityMatchKey) ToHost() *AffinityMatchKey
ToHost returns the key in the host byte order
func (*AffinityMatchKey) ToNetwork ¶
func (k *AffinityMatchKey) ToNetwork() *AffinityMatchKey
ToNetwork returns the key in the network byte order
type AffinityMatchValue ¶
type AffinityMatchValue struct {
Pad uint8 `align:"pad"`
}
func (*AffinityMatchValue) New ¶
func (v *AffinityMatchValue) New() bpf.MapValue
func (*AffinityMatchValue) String ¶
func (v *AffinityMatchValue) String() string
String converts the value into a human readable string format
type AffinityValue ¶
type AffinityValue struct {
LastUsed uint64 `align:"last_used"`
BackendID uint32 `align:"backend_id"`
Pad uint32 `align:"pad"`
}
AffinityValue is the Go representing of lb_affinity_value
func (*AffinityValue) New ¶
func (v *AffinityValue) New() bpf.MapValue
func (*AffinityValue) String ¶
func (v *AffinityValue) String() string
String converts the value into a human readable string format.
type BPFLBMaps ¶
type BPFLBMaps struct {
// Pinned if true will pin the maps to a file. Tests may turn this off.
Pinned bool
Log *slog.Logger
Cfg loadbalancer.Config
ExtCfg loadbalancer.ExternalConfig
MaglevCfg maglev.Config
// contains filtered or unexported fields
}
func (*BPFLBMaps) DeleteAffinityMatch ¶
func (r *BPFLBMaps) DeleteAffinityMatch(key *AffinityMatchKey) error
DeleteAffinityMatch implements lbmaps.
func (*BPFLBMaps) DeleteBackend ¶
func (r *BPFLBMaps) DeleteBackend(key BackendKey) error
DeleteBackend implements lbmaps.
func (*BPFLBMaps) DeleteMaglev ¶
func (r *BPFLBMaps) DeleteMaglev(key MaglevOuterKey, ipv6 bool) error
DeleteMaglev implements lbmaps.
func (*BPFLBMaps) DeleteRevNat ¶
DeleteRevNat implements lbmaps.
func (*BPFLBMaps) DeleteService ¶
func (r *BPFLBMaps) DeleteService(key ServiceKey) error
DeleteService implements lbmaps.
func (*BPFLBMaps) DeleteSockRevNat ¶
DeleteSockRevNat implements LBMaps.
func (*BPFLBMaps) DeleteSourceRange ¶
func (r *BPFLBMaps) DeleteSourceRange(key SourceRangeKey) error
DeleteSourceRange implements lbmaps.
func (*BPFLBMaps) DumpAffinityMatch ¶
func (r *BPFLBMaps) DumpAffinityMatch(cb func(*AffinityMatchKey, *AffinityMatchValue)) error
DumpAffinityMatch implements lbmaps.
func (*BPFLBMaps) DumpBackend ¶
func (r *BPFLBMaps) DumpBackend(cb func(BackendKey, BackendValue)) error
DumpBackend implements lbmaps.
func (*BPFLBMaps) DumpMaglev ¶
func (r *BPFLBMaps) DumpMaglev(cb func(MaglevOuterKey, MaglevOuterVal, MaglevInnerKey, *MaglevInnerVal, bool)) error
func (*BPFLBMaps) DumpRevNat ¶
func (r *BPFLBMaps) DumpRevNat(cb func(RevNatKey, RevNatValue)) error
DumpRevNat implements lbmaps.
func (*BPFLBMaps) DumpService ¶
func (r *BPFLBMaps) DumpService(cb func(ServiceKey, ServiceValue)) error
DumpService implements lbmaps.
func (*BPFLBMaps) DumpSourceRange ¶
func (r *BPFLBMaps) DumpSourceRange(cb func(SourceRangeKey, *SourceRangeValue)) error
DumpSourceRange implements lbmaps.
func (*BPFLBMaps) ExistsSockRevNat ¶
func (*BPFLBMaps) LookupBackend ¶
func (r *BPFLBMaps) LookupBackend(key BackendKey) (val BackendValue, err error)
func (*BPFLBMaps) Start ¶
func (r *BPFLBMaps) Start(ctx cell.HookContext) (err error)
Start implements cell.HookInterface.
func (*BPFLBMaps) Stop ¶
func (r *BPFLBMaps) Stop(cell.HookContext) error
Stop implements cell.HookInterface.
func (*BPFLBMaps) UpdateAffinityMatch ¶
func (r *BPFLBMaps) UpdateAffinityMatch(key *AffinityMatchKey, value *AffinityMatchValue) error
UpdateAffinityMatch implements lbmaps.
func (*BPFLBMaps) UpdateBackend ¶
func (r *BPFLBMaps) UpdateBackend(key BackendKey, value BackendValue) error
UpdateBackend implements lbmaps.
func (*BPFLBMaps) UpdateMaglev ¶
func (r *BPFLBMaps) UpdateMaglev(key MaglevOuterKey, backendIDs []loadbalancer.BackendID, ipv6 bool) error
UpdateMaglev implements lbmaps.
func (*BPFLBMaps) UpdateRevNat ¶
func (r *BPFLBMaps) UpdateRevNat(key RevNatKey, value RevNatValue) error
UpdateRevNat4 implements lbmaps.
func (*BPFLBMaps) UpdateService ¶
func (r *BPFLBMaps) UpdateService(key ServiceKey, value ServiceValue) error
UpdateService implements lbmaps.
func (*BPFLBMaps) UpdateSockRevNat ¶
func (r *BPFLBMaps) UpdateSockRevNat(cookie uint64, addr net.IP, port uint16, revNatIndex uint16) error
UpdateSockRevNat implements LBMaps.
func (*BPFLBMaps) UpdateSourceRange ¶
func (r *BPFLBMaps) UpdateSourceRange(key SourceRangeKey, value *SourceRangeValue) error
UpdateSourceRange implements lbmaps.
type Backend ¶
type Backend interface {
// Get key of the backend entry
GetKey() BackendKey
// Get value of the backend entry
GetValue() BackendValue
}
Backend is the interface describing protocol independent backend used by services v2.
type Backend4KeyV3 ¶
type Backend4KeyV3 struct {
ID loadbalancer.BackendID
}
func NewBackend4KeyV3 ¶
func NewBackend4KeyV3(id loadbalancer.BackendID) *Backend4KeyV3
func (*Backend4KeyV3) GetID ¶
func (k *Backend4KeyV3) GetID() loadbalancer.BackendID
func (*Backend4KeyV3) New ¶
func (k *Backend4KeyV3) New() bpf.MapKey
func (*Backend4KeyV3) SetID ¶
func (k *Backend4KeyV3) SetID(id loadbalancer.BackendID)
func (*Backend4KeyV3) String ¶
func (k *Backend4KeyV3) String() string
type Backend4V3 ¶
type Backend4V3 struct {
Key *Backend4KeyV3
Value *Backend4ValueV3
}
func NewBackend4V3 ¶
func NewBackend4V3(id loadbalancer.BackendID, addrCluster cmtypes.AddrCluster, port uint16, proto u8proto.U8proto, state loadbalancer.BackendState, zone uint8) (*Backend4V3, error)
func (*Backend4V3) GetKey ¶
func (b *Backend4V3) GetKey() BackendKey
func (*Backend4V3) GetValue ¶
func (b *Backend4V3) GetValue() BackendValue
type Backend4ValueV3 ¶
type Backend4ValueV3 struct {
Address types.IPv4 `align:"address"`
Port uint16 `align:"port"`
Proto u8proto.U8proto `align:"proto"`
Flags uint8 `align:"flags"`
ClusterID uint16 `align:"cluster_id"`
Zone uint8 `align:"zone"`
Pad uint8 `align:"pad"`
}
func NewBackend4ValueV3 ¶
func NewBackend4ValueV3(addrCluster cmtypes.AddrCluster, port uint16, proto u8proto.U8proto, state loadbalancer.BackendState, zone uint8) (*Backend4ValueV3, error)
func (*Backend4ValueV3) GetAddress ¶
func (b *Backend4ValueV3) GetAddress() cmtypes.AddrCluster
func (*Backend4ValueV3) GetFlags ¶
func (b *Backend4ValueV3) GetFlags() uint8
func (*Backend4ValueV3) GetPort ¶
func (b *Backend4ValueV3) GetPort() uint16
func (*Backend4ValueV3) GetProtocol ¶
func (b *Backend4ValueV3) GetProtocol() uint8
func (*Backend4ValueV3) GetZone ¶
func (b *Backend4ValueV3) GetZone() uint8
func (*Backend4ValueV3) New ¶
func (b *Backend4ValueV3) New() bpf.MapValue
func (*Backend4ValueV3) String ¶
func (v *Backend4ValueV3) String() string
func (*Backend4ValueV3) ToHost ¶
func (v *Backend4ValueV3) ToHost() BackendValue
ToHost converts Backend4Value to host byte order.
func (*Backend4ValueV3) ToNetwork ¶
func (v *Backend4ValueV3) ToNetwork() BackendValue
type Backend6KeyV3 ¶
type Backend6KeyV3 struct {
ID loadbalancer.BackendID
}
func NewBackend6KeyV3 ¶
func NewBackend6KeyV3(id loadbalancer.BackendID) *Backend6KeyV3
func (*Backend6KeyV3) GetID ¶
func (k *Backend6KeyV3) GetID() loadbalancer.BackendID
func (*Backend6KeyV3) New ¶
func (k *Backend6KeyV3) New() bpf.MapKey
func (*Backend6KeyV3) SetID ¶
func (k *Backend6KeyV3) SetID(id loadbalancer.BackendID)
func (*Backend6KeyV3) String ¶
func (k *Backend6KeyV3) String() string
type Backend6V3 ¶
type Backend6V3 struct {
Key *Backend6KeyV3
Value *Backend6ValueV3
}
func NewBackend6V3 ¶
func NewBackend6V3(id loadbalancer.BackendID, addrCluster cmtypes.AddrCluster, port uint16, proto u8proto.U8proto, state loadbalancer.BackendState, zone uint8) (*Backend6V3, error)
func (*Backend6V3) GetKey ¶
func (b *Backend6V3) GetKey() BackendKey
func (*Backend6V3) GetValue ¶
func (b *Backend6V3) GetValue() BackendValue
type Backend6ValueV3 ¶
type Backend6ValueV3 struct {
Address types.IPv6 `align:"address"`
Port uint16 `align:"port"`
Proto u8proto.U8proto `align:"proto"`
Flags uint8 `align:"flags"`
ClusterID uint16 `align:"cluster_id"`
Zone uint8 `align:"zone"`
Pad uint8 `align:"pad"`
}
func NewBackend6ValueV3 ¶
func NewBackend6ValueV3(addrCluster cmtypes.AddrCluster, port uint16, proto u8proto.U8proto, state loadbalancer.BackendState, zone uint8) (*Backend6ValueV3, error)
func (*Backend6ValueV3) GetAddress ¶
func (b *Backend6ValueV3) GetAddress() cmtypes.AddrCluster
func (*Backend6ValueV3) GetFlags ¶
func (b *Backend6ValueV3) GetFlags() uint8
func (*Backend6ValueV3) GetPort ¶
func (b *Backend6ValueV3) GetPort() uint16
func (*Backend6ValueV3) GetProtocol ¶
func (b *Backend6ValueV3) GetProtocol() uint8
func (*Backend6ValueV3) GetZone ¶
func (b *Backend6ValueV3) GetZone() uint8
func (*Backend6ValueV3) New ¶
func (v *Backend6ValueV3) New() bpf.MapValue
func (*Backend6ValueV3) String ¶
func (v *Backend6ValueV3) String() string
func (*Backend6ValueV3) ToHost ¶
func (v *Backend6ValueV3) ToHost() BackendValue
ToHost converts Backend6ValueV3 to host byte order.
func (*Backend6ValueV3) ToNetwork ¶
func (v *Backend6ValueV3) ToNetwork() BackendValue
type BackendKey ¶
type BackendKey interface {
bpf.MapKey
// Set backend identifier
SetID(loadbalancer.BackendID)
// Get backend identifier
GetID() loadbalancer.BackendID
}
BackendKey is the interface describing protocol independent backend key.
type BackendValue ¶
type BackendValue interface {
bpf.MapValue
// Get backend address
GetAddress() cmtypes.AddrCluster
// Get backend port
GetPort() uint16
// Get backend protocol
GetProtocol() uint8
// Get backend flags
GetFlags() uint8
// Get zone
GetZone() uint8
// Convert fields to network byte order.
ToNetwork() BackendValue
// ToHost converts fields to host byte order.
ToHost() BackendValue
}
BackendValue is the interface describing backend value.
type FakeLBMaps ¶
type FakeLBMaps struct {
// contains filtered or unexported fields
}
func (*FakeLBMaps) DeleteAffinityMatch ¶
func (f *FakeLBMaps) DeleteAffinityMatch(key *AffinityMatchKey) error
DeleteAffinityMatch implements lbmaps.
func (*FakeLBMaps) DeleteBackend ¶
func (f *FakeLBMaps) DeleteBackend(key BackendKey) error
DeleteBackend implements lbmaps.
func (*FakeLBMaps) DeleteMaglev ¶
func (f *FakeLBMaps) DeleteMaglev(key MaglevOuterKey, ipv6 bool) error
DeleteMaglev implements lbmaps.
func (*FakeLBMaps) DeleteRevNat ¶
func (f *FakeLBMaps) DeleteRevNat(key RevNatKey) error
DeleteRevNat implements lbmaps.
func (*FakeLBMaps) DeleteService ¶
func (f *FakeLBMaps) DeleteService(key ServiceKey) error
DeleteService implements lbmaps.
func (*FakeLBMaps) DeleteSockRevNat ¶
DeleteSockRevNat implements LBMaps.
func (*FakeLBMaps) DeleteSourceRange ¶
func (f *FakeLBMaps) DeleteSourceRange(key SourceRangeKey) error
DeleteSourceRange implements lbmaps.
func (*FakeLBMaps) DumpAffinityMatch ¶
func (f *FakeLBMaps) DumpAffinityMatch(cb func(*AffinityMatchKey, *AffinityMatchValue)) error
DumpAffinityMatch implements lbmaps.
func (*FakeLBMaps) DumpBackend ¶
func (f *FakeLBMaps) DumpBackend(cb func(BackendKey, BackendValue)) error
DumpBackend implements lbmaps.
func (*FakeLBMaps) DumpMaglev ¶
func (f *FakeLBMaps) DumpMaglev(cb func(MaglevOuterKey, MaglevOuterVal, MaglevInnerKey, *MaglevInnerVal, bool)) error
func (*FakeLBMaps) DumpRevNat ¶
func (f *FakeLBMaps) DumpRevNat(cb func(RevNatKey, RevNatValue)) error
DumpRevNat implements lbmaps.
func (*FakeLBMaps) DumpService ¶
func (f *FakeLBMaps) DumpService(cb func(ServiceKey, ServiceValue)) error
DumpService implements lbmaps.
func (*FakeLBMaps) DumpSourceRange ¶
func (f *FakeLBMaps) DumpSourceRange(cb func(SourceRangeKey, *SourceRangeValue)) error
DumpSourceRange implements lbmaps.
func (*FakeLBMaps) ExistsSockRevNat ¶
func (*FakeLBMaps) LookupBackend ¶
func (f *FakeLBMaps) LookupBackend(key BackendKey) (BackendValue, error)
LookupBackend implements LBMaps.
func (*FakeLBMaps) UpdateAffinityMatch ¶
func (f *FakeLBMaps) UpdateAffinityMatch(key *AffinityMatchKey, value *AffinityMatchValue) error
UpdateAffinityMatch implements lbmaps.
func (*FakeLBMaps) UpdateBackend ¶
func (f *FakeLBMaps) UpdateBackend(key BackendKey, value BackendValue) error
UpdateBackend implements lbmaps.
func (*FakeLBMaps) UpdateMaglev ¶
func (f *FakeLBMaps) UpdateMaglev(key MaglevOuterKey, backendIDs []loadbalancer.BackendID, ipv6 bool) error
UpdateMaglev implements lbmaps.
func (*FakeLBMaps) UpdateRevNat ¶
func (f *FakeLBMaps) UpdateRevNat(key RevNatKey, value RevNatValue) error
UpdateRevNat implements lbmaps.
func (*FakeLBMaps) UpdateService ¶
func (f *FakeLBMaps) UpdateService(key ServiceKey, value ServiceValue) error
UpdateService implements lbmaps.
func (*FakeLBMaps) UpdateSockRevNat ¶
func (f *FakeLBMaps) UpdateSockRevNat(cookie uint64, addr net.IP, port uint16, revNatIndex uint16) error
UpdateSockRevNat implements LBMaps.
func (*FakeLBMaps) UpdateSourceRange ¶
func (f *FakeLBMaps) UpdateSourceRange(key SourceRangeKey, value *SourceRangeValue) error
UpdateSourceRange implements lbmaps.
type FaultyLBMaps ¶
type FaultyLBMaps struct {
// contains filtered or unexported fields
}
func (*FaultyLBMaps) DeleteAffinityMatch ¶
func (f *FaultyLBMaps) DeleteAffinityMatch(key *AffinityMatchKey) error
DeleteAffinityMatch implements lbmaps.
func (*FaultyLBMaps) DeleteBackend ¶
func (f *FaultyLBMaps) DeleteBackend(key BackendKey) error
DeleteBackend implements lbmaps.
func (*FaultyLBMaps) DeleteMaglev ¶
func (f *FaultyLBMaps) DeleteMaglev(key MaglevOuterKey, ipv6 bool) error
DeleteMaglev implements lbmaps.
func (*FaultyLBMaps) DeleteRevNat ¶
func (f *FaultyLBMaps) DeleteRevNat(key RevNatKey) error
DeleteRevNat implements lbmaps.
func (*FaultyLBMaps) DeleteService ¶
func (f *FaultyLBMaps) DeleteService(key ServiceKey) error
DeleteService implements lbmaps.
func (*FaultyLBMaps) DeleteSockRevNat ¶
DeleteSockRevNat implements LBMaps.
func (*FaultyLBMaps) DeleteSourceRange ¶
func (f *FaultyLBMaps) DeleteSourceRange(key SourceRangeKey) error
DeleteSourceRange implements lbmaps.
func (*FaultyLBMaps) DumpAffinityMatch ¶
func (f *FaultyLBMaps) DumpAffinityMatch(cb func(*AffinityMatchKey, *AffinityMatchValue)) error
DumpAffinityMatch implements lbmaps.
func (*FaultyLBMaps) DumpBackend ¶
func (f *FaultyLBMaps) DumpBackend(cb func(BackendKey, BackendValue)) error
DumpBackend implements lbmaps.
func (*FaultyLBMaps) DumpMaglev ¶
func (f *FaultyLBMaps) DumpMaglev(cb func(MaglevOuterKey, MaglevOuterVal, MaglevInnerKey, *MaglevInnerVal, bool)) error
DumpMaglev implements lbmaps.
func (*FaultyLBMaps) DumpRevNat ¶
func (f *FaultyLBMaps) DumpRevNat(cb func(RevNatKey, RevNatValue)) error
DumpRevNat implements lbmaps.
func (*FaultyLBMaps) DumpService ¶
func (f *FaultyLBMaps) DumpService(cb func(ServiceKey, ServiceValue)) error
DumpService implements lbmaps.
func (*FaultyLBMaps) DumpSourceRange ¶
func (f *FaultyLBMaps) DumpSourceRange(cb func(SourceRangeKey, *SourceRangeValue)) error
DumpSourceRange implements lbmaps.
func (*FaultyLBMaps) ExistsSockRevNat ¶
func (*FaultyLBMaps) LookupBackend ¶
func (f *FaultyLBMaps) LookupBackend(key BackendKey) (BackendValue, error)
LookupBackend implements LBMaps.
func (*FaultyLBMaps) UpdateAffinityMatch ¶
func (f *FaultyLBMaps) UpdateAffinityMatch(key *AffinityMatchKey, value *AffinityMatchValue) error
UpdateAffinityMatch implements lbmaps.
func (*FaultyLBMaps) UpdateBackend ¶
func (f *FaultyLBMaps) UpdateBackend(key BackendKey, value BackendValue) error
UpdateBackend implements lbmaps.
func (*FaultyLBMaps) UpdateMaglev ¶
func (f *FaultyLBMaps) UpdateMaglev(key MaglevOuterKey, backendIDs []loadbalancer.BackendID, ipv6 bool) error
UpdateMaglev implements lbmaps.
func (*FaultyLBMaps) UpdateRevNat ¶
func (f *FaultyLBMaps) UpdateRevNat(key RevNatKey, value RevNatValue) error
UpdateRevNat implements lbmaps.
func (*FaultyLBMaps) UpdateService ¶
func (f *FaultyLBMaps) UpdateService(key ServiceKey, value ServiceValue) error
UpdateService implements lbmaps.
func (*FaultyLBMaps) UpdateSockRevNat ¶
func (f *FaultyLBMaps) UpdateSockRevNat(cookie uint64, addr net.IP, port uint16, revNatIndex uint16) error
UpdateSockRevNat implements LBMaps.
func (*FaultyLBMaps) UpdateSourceRange ¶
func (f *FaultyLBMaps) UpdateSourceRange(key SourceRangeKey, value *SourceRangeValue) error
UpdateSourceRange implements lbmaps.
type HaveNetNSCookieSupport ¶
type HaveNetNSCookieSupport func() bool
func NetnsCookieSupportFunc ¶
func NetnsCookieSupportFunc() HaveNetNSCookieSupport
type LBMaps ¶
type LBMaps interface {
IsEmpty() bool
// contains filtered or unexported methods
}
LBMaps defines the map operations performed by the reconciliation. Depending on this interface instead of on the underlying maps allows testing the implementation with a fake map or injected errors.
func NewFakeLBMaps ¶
func NewFakeLBMaps() LBMaps
type MaglevInnerKey ¶
type MaglevInnerKey struct {
Zero uint32
}
MaglevInnerKey is the key of a maglev inner map.
func (*MaglevInnerKey) New ¶
func (k *MaglevInnerKey) New() bpf.MapKey
New and String implement bpf.MapKey
func (*MaglevInnerKey) String ¶
func (k *MaglevInnerKey) String() string
type MaglevInnerMap ¶
MaglevInnerMap represents a maglev inner map.
func MaglevInnerMapFromID ¶
func MaglevInnerMapFromID(id uint32) (MaglevInnerMap, error)
MaglevInnerMapFromID returns a new object representing the maglev inner map identified by an ID.
func (MaglevInnerMap) DumpBackends ¶
func (m MaglevInnerMap) DumpBackends() (string, error)
DumpBackends returns the first key of the map as stringified ints for dumping purposes.
func (MaglevInnerMap) Lookup ¶
func (m MaglevInnerMap) Lookup(key *MaglevInnerKey) (*MaglevInnerVal, error)
Lookup returns the value associated with a given key for a maglev inner map.
func (MaglevInnerMap) TableSize ¶
func (m MaglevInnerMap) TableSize() uint32
TableSize returns the amount of backends this map can hold as a value.
type MaglevInnerVal ¶
type MaglevInnerVal struct {
BackendIDs []loadbalancer.BackendID
}
MaglevInnerVal is the value of a maglev inner map.
type MaglevOuterKey ¶
type MaglevOuterKey struct {
RevNatID uint16
}
MaglevOuterKey is the key of a maglev outer map.
func (*MaglevOuterKey) New ¶
func (k *MaglevOuterKey) New() bpf.MapKey
New and String implement bpf.MapKey
func (*MaglevOuterKey) String ¶
func (k *MaglevOuterKey) String() string
func (MaglevOuterKey) ToNetwork ¶
func (k MaglevOuterKey) ToNetwork() MaglevOuterKey
toNetwork converts a maglev outer map's key to network byte order. The key is in network byte order in the eBPF maps.
type MaglevOuterVal ¶
type MaglevOuterVal struct {
FD uint32
}
MaglevOuterVal is the value of a maglev outer map.
func (*MaglevOuterVal) New ¶
func (m *MaglevOuterVal) New() bpf.MapValue
New implements bpf.MapValue.
func (*MaglevOuterVal) String ¶
func (m *MaglevOuterVal) String() string
String implements bpf.MapValue.
type MapDump ¶
type MapDump = string
MapDump is a dump of a BPF map. These are generated by the dump() method, which solely defines the format.
func DumpLBMaps ¶
func DumpLBMaps(lbmaps LBMaps, sanitizeIDs bool, customizeAddr func(types.AddrCluster, uint16) string) (out []MapDump)
DumpLBMaps the load-balancing maps into a concise format for assertions in tests.
type RevNat4Key ¶
type RevNat4Key struct {
Key uint16
}
func NewRevNat4Key ¶
func NewRevNat4Key(id loadbalancer.ServiceID) *RevNat4Key
func (*RevNat4Key) GetKey ¶
func (v *RevNat4Key) GetKey() loadbalancer.ServiceID
func (*RevNat4Key) New ¶
func (k *RevNat4Key) New() bpf.MapKey
func (*RevNat4Key) String ¶
func (k *RevNat4Key) String() string
func (*RevNat4Key) ToHost ¶
func (k *RevNat4Key) ToHost() RevNatKey
ToHost converts RevNat4Key to host byte order.
func (*RevNat4Key) ToNetwork ¶
func (k *RevNat4Key) ToNetwork() RevNatKey
ToNetwork converts RevNat4Key to network byte order.
type RevNat4Value ¶
func (*RevNat4Value) New ¶
func (v *RevNat4Value) New() bpf.MapValue
func (*RevNat4Value) String ¶
func (v *RevNat4Value) String() string
func (*RevNat4Value) ToHost ¶
func (k *RevNat4Value) ToHost() RevNatValue
ToHost converts RevNat4Value to host byte order.
func (*RevNat4Value) ToNetwork ¶
func (v *RevNat4Value) ToNetwork() RevNatValue
ToNetwork converts RevNat4Value to network byte order.
type RevNat6Key ¶
type RevNat6Key struct {
Key uint16
}
func NewRevNat6Key ¶
func NewRevNat6Key(value uint16) *RevNat6Key
func (*RevNat6Key) GetKey ¶
func (v *RevNat6Key) GetKey() loadbalancer.ServiceID
func (*RevNat6Key) New ¶
func (v *RevNat6Key) New() bpf.MapKey
func (*RevNat6Key) String ¶
func (v *RevNat6Key) String() string
func (*RevNat6Key) ToHost ¶
func (v *RevNat6Key) ToHost() RevNatKey
ToNetwork converts RevNat6Key to host byte order.
func (*RevNat6Key) ToNetwork ¶
func (v *RevNat6Key) ToNetwork() RevNatKey
ToNetwork converts RevNat6Key to network byte order.
type RevNat6Value ¶
func (*RevNat6Value) New ¶
func (v *RevNat6Value) New() bpf.MapValue
func (*RevNat6Value) String ¶
func (v *RevNat6Value) String() string
func (*RevNat6Value) ToHost ¶
func (v *RevNat6Value) ToHost() RevNatValue
ToNetwork converts RevNat6Value to Host byte order.
func (*RevNat6Value) ToNetwork ¶
func (v *RevNat6Value) ToNetwork() RevNatValue
ToNetwork converts RevNat6Value to network byte order.
type RevNatValue ¶
type RevNatValue interface {
bpf.MapValue
// ToNetwork converts fields to network byte order.
ToNetwork() RevNatValue
// ToHost converts fields to host byte order.
ToHost() RevNatValue
}
type Service4Key ¶
type Service4Key struct {
Address types.IPv4 `align:"address"`
Port uint16 `align:"dport"`
BackendSlot uint16 `align:"backend_slot"`
Proto uint8 `align:"proto"`
Scope uint8 `align:"scope"`
Pad pad2uint8 `align:"pad"`
}
Service4Key must match 'struct lb4_key' in "bpf/lib/common.h".
func NewService4Key ¶
func (*Service4Key) GetAddress ¶
func (k *Service4Key) GetAddress() net.IP
func (*Service4Key) GetBackendSlot ¶
func (k *Service4Key) GetBackendSlot() int
func (*Service4Key) GetPort ¶
func (k *Service4Key) GetPort() uint16
func (*Service4Key) GetProtocol ¶
func (k *Service4Key) GetProtocol() uint8
func (*Service4Key) GetScope ¶
func (k *Service4Key) GetScope() uint8
func (*Service4Key) IsIPv6 ¶
func (k *Service4Key) IsIPv6() bool
func (*Service4Key) IsSurrogate ¶
func (k *Service4Key) IsSurrogate() bool
func (*Service4Key) New ¶
func (k *Service4Key) New() bpf.MapKey
func (*Service4Key) RevNatValue ¶
func (k *Service4Key) RevNatValue() RevNatValue
func (*Service4Key) SetBackendSlot ¶
func (k *Service4Key) SetBackendSlot(slot int)
func (*Service4Key) SetScope ¶
func (k *Service4Key) SetScope(scope uint8)
func (*Service4Key) String ¶
func (k *Service4Key) String() string
func (*Service4Key) ToHost ¶
func (k *Service4Key) ToHost() ServiceKey
ToHost converts Service4Key to host byte order.
func (*Service4Key) ToNetwork ¶
func (k *Service4Key) ToNetwork() ServiceKey
type Service4Value ¶
type Service4Value struct {
BackendID uint32 `align:"$union0"`
Count uint16 `align:"count"`
RevNat uint16 `align:"rev_nat_index"`
Flags uint8 `align:"flags"`
Flags2 uint8 `align:"flags2"`
QCount uint16 `align:"qcount"`
}
Service4Value must match 'struct lb4_service' in "bpf/lib/common.h".
func (*Service4Value) GetBackendID ¶
func (s *Service4Value) GetBackendID() loadbalancer.BackendID
func (*Service4Value) GetCount ¶
func (s *Service4Value) GetCount() int
func (*Service4Value) GetFlags ¶
func (s *Service4Value) GetFlags() uint16
func (*Service4Value) GetL7LBProxyPort ¶
func (s *Service4Value) GetL7LBProxyPort() uint16
func (*Service4Value) GetLbAlg ¶
func (s *Service4Value) GetLbAlg() loadbalancer.SVCLoadBalancingAlgorithm
func (*Service4Value) GetQCount ¶
func (s *Service4Value) GetQCount() int
func (*Service4Value) GetRevNat ¶
func (s *Service4Value) GetRevNat() int
func (*Service4Value) GetSessionAffinityTimeoutSec ¶
func (s *Service4Value) GetSessionAffinityTimeoutSec() uint32
func (*Service4Value) New ¶
func (s *Service4Value) New() bpf.MapValue
func (*Service4Value) RevNatKey ¶
func (s *Service4Value) RevNatKey() RevNatKey
func (*Service4Value) SetBackendID ¶
func (s *Service4Value) SetBackendID(id loadbalancer.BackendID)
func (*Service4Value) SetCount ¶
func (s *Service4Value) SetCount(count int)
func (*Service4Value) SetFlags ¶
func (s *Service4Value) SetFlags(flags uint16)
func (*Service4Value) SetL7LBProxyPort ¶
func (s *Service4Value) SetL7LBProxyPort(port uint16)
func (*Service4Value) SetLbAlg ¶
func (s *Service4Value) SetLbAlg(lb loadbalancer.SVCLoadBalancingAlgorithm)
func (*Service4Value) SetQCount ¶
func (s *Service4Value) SetQCount(count int)
func (*Service4Value) SetRevNat ¶
func (s *Service4Value) SetRevNat(id int)
func (*Service4Value) SetSessionAffinityTimeoutSec ¶
func (s *Service4Value) SetSessionAffinityTimeoutSec(t uint32) error
func (*Service4Value) String ¶
func (s *Service4Value) String() string
func (*Service4Value) ToHost ¶
func (s *Service4Value) ToHost() ServiceValue
ToHost converts Service4Value to host byte order.
func (*Service4Value) ToNetwork ¶
func (s *Service4Value) ToNetwork() ServiceValue
type Service6Key ¶
type Service6Key struct {
Address types.IPv6 `align:"address"`
Port uint16 `align:"dport"`
BackendSlot uint16 `align:"backend_slot"`
Proto uint8 `align:"proto"`
Scope uint8 `align:"scope"`
Pad pad2uint8 `align:"pad"`
}
Service6Key must match 'struct lb6_key' in "bpf/lib/common.h".
func NewService6Key ¶
func (*Service6Key) GetAddress ¶
func (k *Service6Key) GetAddress() net.IP
func (*Service6Key) GetBackendSlot ¶
func (k *Service6Key) GetBackendSlot() int
func (*Service6Key) GetPort ¶
func (k *Service6Key) GetPort() uint16
func (*Service6Key) GetProtocol ¶
func (k *Service6Key) GetProtocol() uint8
func (*Service6Key) GetScope ¶
func (k *Service6Key) GetScope() uint8
func (*Service6Key) IsIPv6 ¶
func (k *Service6Key) IsIPv6() bool
func (*Service6Key) IsSurrogate ¶
func (k *Service6Key) IsSurrogate() bool
func (*Service6Key) New ¶
func (k *Service6Key) New() bpf.MapKey
func (*Service6Key) RevNatValue ¶
func (k *Service6Key) RevNatValue() RevNatValue
func (*Service6Key) SetBackendSlot ¶
func (k *Service6Key) SetBackendSlot(slot int)
func (*Service6Key) SetScope ¶
func (k *Service6Key) SetScope(scope uint8)
func (*Service6Key) String ¶
func (k *Service6Key) String() string
func (*Service6Key) ToHost ¶
func (k *Service6Key) ToHost() ServiceKey
ToHost converts Service6Key to host byte order.
func (*Service6Key) ToNetwork ¶
func (k *Service6Key) ToNetwork() ServiceKey
type Service6Value ¶
type Service6Value struct {
BackendID uint32 `align:"$union0"`
Count uint16 `align:"count"`
RevNat uint16 `align:"rev_nat_index"`
Flags uint8 `align:"flags"`
Flags2 uint8 `align:"flags2"`
QCount uint16 `align:"qcount"`
}
Service6Value must match 'struct lb6_service' in "bpf/lib/common.h".
func (*Service6Value) GetBackendID ¶
func (s *Service6Value) GetBackendID() loadbalancer.BackendID
func (*Service6Value) GetCount ¶
func (s *Service6Value) GetCount() int
func (*Service6Value) GetFlags ¶
func (s *Service6Value) GetFlags() uint16
func (*Service6Value) GetL7LBProxyPort ¶
func (s *Service6Value) GetL7LBProxyPort() uint16
func (*Service6Value) GetLbAlg ¶
func (s *Service6Value) GetLbAlg() loadbalancer.SVCLoadBalancingAlgorithm
func (*Service6Value) GetQCount ¶
func (s *Service6Value) GetQCount() int
func (*Service6Value) GetRevNat ¶
func (s *Service6Value) GetRevNat() int
func (*Service6Value) GetSessionAffinityTimeoutSec ¶
func (s *Service6Value) GetSessionAffinityTimeoutSec() uint32
func (*Service6Value) New ¶
func (s *Service6Value) New() bpf.MapValue
func (*Service6Value) RevNatKey ¶
func (s *Service6Value) RevNatKey() RevNatKey
func (*Service6Value) SetBackendID ¶
func (s *Service6Value) SetBackendID(id loadbalancer.BackendID)
func (*Service6Value) SetCount ¶
func (s *Service6Value) SetCount(count int)
func (*Service6Value) SetFlags ¶
func (s *Service6Value) SetFlags(flags uint16)
func (*Service6Value) SetL7LBProxyPort ¶
func (s *Service6Value) SetL7LBProxyPort(port uint16)
func (*Service6Value) SetLbAlg ¶
func (s *Service6Value) SetLbAlg(lb loadbalancer.SVCLoadBalancingAlgorithm)
func (*Service6Value) SetQCount ¶
func (s *Service6Value) SetQCount(count int)
func (*Service6Value) SetRevNat ¶
func (s *Service6Value) SetRevNat(id int)
func (*Service6Value) SetSessionAffinityTimeoutSec ¶
func (s *Service6Value) SetSessionAffinityTimeoutSec(t uint32) error
func (*Service6Value) String ¶
func (s *Service6Value) String() string
func (*Service6Value) ToHost ¶
func (s *Service6Value) ToHost() ServiceValue
ToHost converts Service6Value to host byte order.
func (*Service6Value) ToNetwork ¶
func (s *Service6Value) ToNetwork() ServiceValue
type ServiceKey ¶
type ServiceKey interface {
bpf.MapKey
// Return true if the key is of type IPv6
IsIPv6() bool
// IsSurrogate returns true on zero-address
IsSurrogate() bool
// Set backend slot for the key
SetBackendSlot(slot int)
// Get backend slot of the key
GetBackendSlot() int
// Set lookup scope for the key
SetScope(scope uint8)
// Get lookup scope for the key
GetScope() uint8
// Get frontend IP address
GetAddress() net.IP
// Get frontend port
GetPort() uint16
// Get protocol
GetProtocol() uint8
// Returns a RevNatValue matching a ServiceKey
RevNatValue() RevNatValue
// ToNetwork converts fields to network byte order.
ToNetwork() ServiceKey
// ToHost converts fields to host byte order.
ToHost() ServiceKey
}
ServiceKey is the interface describing key for services map v2.
type ServiceValue ¶
type ServiceValue interface {
bpf.MapValue
// Set the number of backends
SetCount(int)
// Get the number of backends
GetCount() int
// Set the number of quarantined backends
SetQCount(int)
// Get the number of quarantined backends
GetQCount() int
// Set reverse NAT identifier
SetRevNat(int)
// Get reverse NAT identifier
GetRevNat() int
// Set flags
SetFlags(uint16)
// Get flags
GetFlags() uint16
// Set timeout for sessionAffinity=clientIP
SetSessionAffinityTimeoutSec(t uint32) error
// Get timeout for sessionAffinity=clientIP
GetSessionAffinityTimeoutSec() uint32
// Set proxy port for l7 loadbalancer services
SetL7LBProxyPort(port uint16)
// Get proxy port for l7 loadbalancer services
GetL7LBProxyPort() uint16
// Set backend identifier
SetBackendID(id loadbalancer.BackendID)
// Get backend identifier
GetBackendID() loadbalancer.BackendID
// Returns a RevNatKey matching a ServiceValue
RevNatKey() RevNatKey
// Convert fields to network byte order.
ToNetwork() ServiceValue
// ToHost converts fields to host byte order.
ToHost() ServiceValue
// Set LoadBalancing Algorithm for Service
SetLbAlg(loadbalancer.SVCLoadBalancingAlgorithm)
// Get LoadBalancing Algorithm for Service
GetLbAlg() loadbalancer.SVCLoadBalancingAlgorithm
}
ServiceValue is the interface describing protocol independent value for services map v2.
type SkipLB4Key ¶
type SkipLB4Key struct {
NetnsCookie uint64 `align:"netns_cookie"`
Address types.IPv4 `align:"address"`
Port uint16 `align:"port"`
Pad int16 `align:"pad"`
}
SkipLB4Key is the tuple with netns cookie, address and port and used as key in the skip LB4 map.
func NewSkipLB4Key ¶
func NewSkipLB4Key(netnsCookie uint64, address net.IP, port uint16) *SkipLB4Key
NewSkipLB4Key creates the SkipLB4Key
func (*SkipLB4Key) New ¶
func (k *SkipLB4Key) New() bpf.MapKey
func (*SkipLB4Key) String ¶
func (k *SkipLB4Key) String() string
String converts the key into a human-readable string format.
type SkipLB4Value ¶
type SkipLB4Value struct {
Pad uint8 `align:"pad"`
}
func (*SkipLB4Value) GetValuePtr ¶
func (v *SkipLB4Value) GetValuePtr() unsafe.Pointer
GetValuePtr returns the unsafe pointer to the BPF value
func (*SkipLB4Value) New ¶
func (v *SkipLB4Value) New() bpf.MapValue
func (*SkipLB4Value) String ¶
func (v *SkipLB4Value) String() string
String converts the value into a human-readable string format.
type SkipLB6Key ¶
type SkipLB6Key struct {
NetnsCookie uint64 `align:"netns_cookie"`
Address types.IPv6 `align:"address"`
Pad uint32 `align:"pad"`
Port uint16 `align:"port"`
Pad2 uint16 `align:"pad2"`
}
SkipLB6Key is the tuple with netns cookie, address and port and used as key in the skip LB6 map.
func NewSkipLB6Key ¶
func NewSkipLB6Key(netnsCookie uint64, address net.IP, port uint16) *SkipLB6Key
NewSkipLB6Key creates the SkipLB6Key
func (*SkipLB6Key) GetKeyPtr ¶
func (k *SkipLB6Key) GetKeyPtr() unsafe.Pointer
GetKeyPtr returns the unsafe pointer to the BPF key
func (*SkipLB6Key) New ¶
func (k *SkipLB6Key) New() bpf.MapKey
func (*SkipLB6Key) NewValue ¶
func (k *SkipLB6Key) NewValue() bpf.MapValue
NewValue returns a new empty instance of the structure representing the BPF map value
func (*SkipLB6Key) String ¶
func (k *SkipLB6Key) String() string
String converts the key into a human-readable string format.
type SkipLB6Value ¶
type SkipLB6Value struct {
Pad uint8 `align:"pad"`
}
func (*SkipLB6Value) GetValuePtr ¶
func (v *SkipLB6Value) GetValuePtr() unsafe.Pointer
GetValuePtr returns the unsafe pointer to the BPF value
func (*SkipLB6Value) New ¶
func (v *SkipLB6Value) New() bpf.MapValue
func (*SkipLB6Value) String ¶
func (v *SkipLB6Value) String() string
String converts the value into a human-readable string format.
type SkipLBMap ¶
type SkipLBMap interface {
AddLB4(netnsCookie uint64, ip net.IP, port uint16) error
AddLB6(netnsCookie uint64, ip net.IP, port uint16) error
DeleteLB4ByAddrPort(ip net.IP, port uint16)
DeleteLB6ByAddrPort(ip net.IP, port uint16)
DeleteLB4ByNetnsCookie(cookie uint64)
DeleteLB6ByNetnsCookie(cookie uint64)
AllLB4() iter.Seq2[*SkipLB4Key, *SkipLB4Value]
AllLB6() iter.Seq2[*SkipLB6Key, *SkipLB6Value]
DeleteLB4(key *SkipLB4Key) error
DeleteLB6(key *SkipLB6Key) error
OpenOrCreate() error
Close() error
}
SkipLBMap provides access to the eBPF map that stores entries for which load-balancing is skipped.
type SockRevNat4Key ¶
type SockRevNat4Key struct {
Cookie uint64 `align:"cookie"`
Address types.IPv4 `align:"address"`
Port int16 `align:"port"`
// contains filtered or unexported fields
}
SockRevNat4Key is the tuple with address, port and cookie used as key in the reverse NAT sock map.
func NewSockRevNat4Key ¶
func NewSockRevNat4Key(cookie uint64, addr net.IP, port uint16) *SockRevNat4Key
func (*SockRevNat4Key) New ¶
func (k *SockRevNat4Key) New() bpf.MapKey
func (*SockRevNat4Key) String ¶
func (k *SockRevNat4Key) String() string
String converts the key into a human readable string format.
type SockRevNat4Value ¶
type SockRevNat4Value struct {
Address types.IPv4 `align:"address"`
Port int16 `align:"port"`
RevNatIndex uint16 `align:"rev_nat_index"`
}
SockRevNat4Value is an entry in the reverse NAT sock map.
func (*SockRevNat4Value) New ¶
func (v *SockRevNat4Value) New() bpf.MapValue
func (*SockRevNat4Value) String ¶
func (v *SockRevNat4Value) String() string
String converts the value into a human readable string format.
type SockRevNat6Key ¶
type SockRevNat6Key struct {
Cookie uint64 `align:"cookie"`
Address types.IPv6 `align:"address"`
Port int16 `align:"port"`
// contains filtered or unexported fields
}
SockRevNat6Key is the tuple with address, port and cookie used as key in the reverse NAT sock map.
func NewSockRevNat6Key ¶
func NewSockRevNat6Key(cookie uint64, addr net.IP, port uint16) *SockRevNat6Key
func (*SockRevNat6Key) New ¶
func (k *SockRevNat6Key) New() bpf.MapKey
func (*SockRevNat6Key) String ¶
func (k *SockRevNat6Key) String() string
String converts the key into a human readable string format.
type SockRevNat6Value ¶
type SockRevNat6Value struct {
Address types.IPv6 `align:"address"`
Port int16 `align:"port"`
RevNatIndex uint16 `align:"rev_nat_index"`
}
SockRevNat6Value is an entry in the reverse NAT sock map.
func (*SockRevNat6Value) New ¶
func (v *SockRevNat6Value) New() bpf.MapValue
func (*SockRevNat6Value) String ¶
func (v *SockRevNat6Value) String() string
String converts the value into a human readable string format.
type SourceRangeKey ¶
type SourceRangeKey interface {
bpf.MapKey
GetCIDR() *cidr.CIDR
GetRevNATID() loadbalancer.ServiceID
// Convert fields to network byte order.
ToNetwork() SourceRangeKey
// ToHost converts fields to host byte order.
ToHost() SourceRangeKey
}
type SourceRangeKey4 ¶
type SourceRangeKey4 struct {
PrefixLen uint32 `align:"lpm_key"`
RevNATID uint16 `align:"rev_nat_id"`
Pad uint16 `align:"pad"`
Address types.IPv4 `align:"addr"`
}
func (*SourceRangeKey4) GetCIDR ¶
func (k *SourceRangeKey4) GetCIDR() *cidr.CIDR
func (*SourceRangeKey4) GetRevNATID ¶
func (k *SourceRangeKey4) GetRevNATID() loadbalancer.ServiceID
func (*SourceRangeKey4) New ¶
func (k *SourceRangeKey4) New() bpf.MapKey
func (*SourceRangeKey4) String ¶
func (k *SourceRangeKey4) String() string
func (*SourceRangeKey4) ToHost ¶
func (k *SourceRangeKey4) ToHost() SourceRangeKey
ToHost returns the key in the host byte order
func (*SourceRangeKey4) ToNetwork ¶
func (k *SourceRangeKey4) ToNetwork() SourceRangeKey
type SourceRangeKey6 ¶
type SourceRangeKey6 struct {
PrefixLen uint32 `align:"lpm_key"`
RevNATID uint16 `align:"rev_nat_id"`
Pad uint16 `align:"pad"`
Address types.IPv6 `align:"addr"`
}
func (*SourceRangeKey6) GetCIDR ¶
func (k *SourceRangeKey6) GetCIDR() *cidr.CIDR
func (*SourceRangeKey6) GetRevNATID ¶
func (k *SourceRangeKey6) GetRevNATID() loadbalancer.ServiceID
func (*SourceRangeKey6) New ¶
func (k *SourceRangeKey6) New() bpf.MapKey
func (*SourceRangeKey6) String ¶
func (k *SourceRangeKey6) String() string
func (*SourceRangeKey6) ToHost ¶
func (k *SourceRangeKey6) ToHost() SourceRangeKey
ToHost returns the key in the host byte order
func (*SourceRangeKey6) ToNetwork ¶
func (k *SourceRangeKey6) ToNetwork() SourceRangeKey
type SourceRangeValue ¶
type SourceRangeValue struct {
Pad uint8 // not used
}
func (*SourceRangeValue) New ¶
func (v *SourceRangeValue) New() bpf.MapValue
func (*SourceRangeValue) String ¶
func (v *SourceRangeValue) String() string