lbmap

package
v1.7.10 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2020 License: Apache-2.0 Imports: 13 Imported by: 36

Documentation

Overview

+groupName=maps

Index

Constants

View Source
const (
	// Maximum number of entries in each hashtable
	MaxEntries = 65536
)

Variables

View Source
var (
	Service4MapV2 = bpf.NewMap("cilium_lb4_services_v2",
		bpf.MapTypeHash,
		&Service4Key{},
		int(unsafe.Sizeof(Service4Key{})),
		&Service4Value{},
		int(unsafe.Sizeof(Service4Value{})),
		MaxEntries,
		0, 0,
		func(key []byte, value []byte, mapKey bpf.MapKey, mapValue bpf.MapValue) (bpf.MapKey, bpf.MapValue, error) {
			svcKey, svcVal := mapKey.(*Service4Key), mapValue.(*Service4Value)

			if _, _, err := bpf.ConvertKeyValue(key, value, svcKey, svcVal); err != nil {
				return nil, nil, err
			}

			return svcKey.ToNetwork(), svcVal.ToNetwork(), nil
		}).WithCache()
	Backend4Map = bpf.NewMap("cilium_lb4_backends",
		bpf.MapTypeHash,
		&Backend4Key{},
		int(unsafe.Sizeof(Backend4Key{})),
		&Backend4Value{},
		int(unsafe.Sizeof(Backend4Value{})),
		MaxEntries,
		0, 0,
		func(key []byte, value []byte, mapKey bpf.MapKey, mapValue bpf.MapValue) (bpf.MapKey, bpf.MapValue, error) {
			backendVal := mapValue.(*Backend4Value)

			if _, _, err := bpf.ConvertKeyValue(key, value, mapKey, backendVal); err != nil {
				return nil, nil, err
			}

			return mapKey, backendVal.ToNetwork(), nil
		}).WithCache()
	RevNat4Map = bpf.NewMap("cilium_lb4_reverse_nat",
		bpf.MapTypeHash,
		&RevNat4Key{},
		int(unsafe.Sizeof(RevNat4Key{})),
		&RevNat4Value{},
		int(unsafe.Sizeof(RevNat4Value{})),
		MaxEntries,
		0, 0,
		func(key []byte, value []byte, mapKey bpf.MapKey, mapValue bpf.MapValue) (bpf.MapKey, bpf.MapValue, error) {
			revKey, revNat := mapKey.(*RevNat4Key), mapValue.(*RevNat4Value)

			if _, _, err := bpf.ConvertKeyValue(key, value, revKey, revNat); err != nil {
				return nil, nil, err
			}

			return revKey.ToNetwork(), revNat.ToNetwork(), nil
		}).WithCache()
)
View Source
var (
	Service6MapV2 = bpf.NewMap("cilium_lb6_services_v2",
		bpf.MapTypeHash,
		&Service6Key{},
		int(unsafe.Sizeof(Service6Key{})),
		&Service6Value{},
		int(unsafe.Sizeof(Service6Value{})),
		MaxEntries,
		0, 0,
		func(key []byte, value []byte, mapKey bpf.MapKey, mapValue bpf.MapValue) (bpf.MapKey, bpf.MapValue, error) {
			svcKey, svcVal := mapKey.(*Service6Key), mapValue.(*Service6Value)

			if _, _, err := bpf.ConvertKeyValue(key, value, svcKey, svcVal); err != nil {
				return nil, nil, err
			}

			return svcKey.ToNetwork(), svcVal.ToNetwork(), nil
		}).WithCache()
	Backend6Map = bpf.NewMap("cilium_lb6_backends",
		bpf.MapTypeHash,
		&Backend6Key{},
		int(unsafe.Sizeof(Backend6Key{})),
		&Backend6Value{},
		int(unsafe.Sizeof(Backend6Value{})),
		MaxEntries,
		0, 0,
		func(key []byte, value []byte, mapKey bpf.MapKey, mapValue bpf.MapValue) (bpf.MapKey, bpf.MapValue, error) {
			backendVal := mapValue.(*Backend6Value)

			if _, _, err := bpf.ConvertKeyValue(key, value, mapKey, backendVal); err != nil {
				return nil, nil, err
			}

			return mapKey, backendVal.ToNetwork(), nil
		}).WithCache()
	// RevNat6Map represents the BPF map for reverse NAT in IPv6 load balancer
	RevNat6Map = bpf.NewMap("cilium_lb6_reverse_nat",
		bpf.MapTypeHash,
		&RevNat6Key{},
		int(unsafe.Sizeof(RevNat6Key{})),
		&RevNat6Value{},
		int(unsafe.Sizeof(RevNat6Value{})),
		MaxEntries,
		0, 0,
		func(key []byte, value []byte, mapKey bpf.MapKey, mapValue bpf.MapValue) (bpf.MapKey, bpf.MapValue, error) {
			revKey, revNat := mapKey.(*RevNat6Key), mapValue.(*RevNat6Value)

			if _, _, err := bpf.ConvertKeyValue(key, value, revKey, revNat); err != nil {
				return nil, nil, err
			}

			return revKey.ToNetwork(), revNat.ToNetwork(), nil
		}).WithCache()
)

Functions

This section is empty.

Types

type Backend added in v0.15.7

type Backend interface {
	// Return the BPF map matching the type
	Map() *bpf.Map

	// 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 Backend4 added in v0.15.7

type Backend4 struct {
	Key   *Backend4Key
	Value *Backend4Value
}

func NewBackend4 added in v1.5.0

func NewBackend4(id loadbalancer.BackendID, ip net.IP, port uint16, proto u8proto.U8proto) (*Backend4, error)

func (*Backend4) GetKey added in v0.15.7

func (b *Backend4) GetKey() BackendKey

func (*Backend4) GetValue added in v0.15.7

func (b *Backend4) GetValue() BackendValue

func (*Backend4) Map added in v0.15.7

func (b *Backend4) Map() *bpf.Map

type Backend4Key added in v0.15.7

type Backend4Key struct {
	ID loadbalancer.BackendID
}

+k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=github.com/cilium/cilium/pkg/bpf.MapKey

func NewBackend4Key added in v1.5.0

func NewBackend4Key(id loadbalancer.BackendID) *Backend4Key

func (*Backend4Key) DeepCopy added in v1.5.1

func (in *Backend4Key) DeepCopy() *Backend4Key

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Backend4Key.

func (*Backend4Key) DeepCopyInto added in v1.5.1

func (in *Backend4Key) DeepCopyInto(out *Backend4Key)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Backend4Key) DeepCopyMapKey added in v1.5.1

func (in *Backend4Key) DeepCopyMapKey() bpf.MapKey

DeepCopyMapKey is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapKey.

func (*Backend4Key) GetID added in v0.15.7

func (k *Backend4Key) GetID() loadbalancer.BackendID

func (*Backend4Key) GetKeyPtr added in v1.5.0

func (k *Backend4Key) GetKeyPtr() unsafe.Pointer

func (*Backend4Key) Map added in v0.15.7

func (k *Backend4Key) Map() *bpf.Map

func (*Backend4Key) NewValue added in v1.5.0

func (k *Backend4Key) NewValue() bpf.MapValue

func (*Backend4Key) SetID added in v0.15.7

func (k *Backend4Key) SetID(id loadbalancer.BackendID)

func (*Backend4Key) String added in v0.15.7

func (k *Backend4Key) String() string

type Backend4Value added in v0.15.7

type Backend4Value struct {
	Address types.IPv4      `align:"address"`
	Port    uint16          `align:"port"`
	Proto   u8proto.U8proto `align:"proto"`
	Pad     uint8           `align:"pad"`
}

Backend4Value must match 'struct lb4_backend' in "bpf/lib/common.h". +k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=github.com/cilium/cilium/pkg/bpf.MapValue

func NewBackend4Value added in v0.15.7

func NewBackend4Value(ip net.IP, port uint16, proto u8proto.U8proto) (*Backend4Value, error)

func (*Backend4Value) DeepCopy added in v1.5.1

func (in *Backend4Value) DeepCopy() *Backend4Value

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Backend4Value.

func (*Backend4Value) DeepCopyInto added in v1.5.1

func (in *Backend4Value) DeepCopyInto(out *Backend4Value)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Backend4Value) DeepCopyMapValue added in v1.5.1

func (in *Backend4Value) DeepCopyMapValue() bpf.MapValue

DeepCopyMapValue is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapValue.

func (*Backend4Value) GetAddress added in v0.15.7

func (b *Backend4Value) GetAddress() net.IP

func (*Backend4Value) GetPort added in v0.15.7

func (b *Backend4Value) GetPort() uint16

func (*Backend4Value) GetValuePtr added in v1.5.0

func (v *Backend4Value) GetValuePtr() unsafe.Pointer

func (*Backend4Value) String added in v0.15.7

func (v *Backend4Value) String() string

func (*Backend4Value) ToNetwork added in v0.15.7

func (v *Backend4Value) ToNetwork() BackendValue

type Backend6 added in v0.15.7

type Backend6 struct {
	Key   *Backend6Key
	Value *Backend6Value
}

func NewBackend6 added in v1.5.0

func NewBackend6(id loadbalancer.BackendID, ip net.IP, port uint16, proto u8proto.U8proto) (*Backend6, error)

func (*Backend6) GetKey added in v0.15.7

func (b *Backend6) GetKey() BackendKey

func (*Backend6) GetValue added in v0.15.7

func (b *Backend6) GetValue() BackendValue

func (*Backend6) Map added in v0.15.7

func (b *Backend6) Map() *bpf.Map

type Backend6Key added in v0.15.7

type Backend6Key struct {
	ID loadbalancer.BackendID
}

+k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=github.com/cilium/cilium/pkg/bpf.MapKey

func NewBackend6Key added in v1.5.0

func NewBackend6Key(id loadbalancer.BackendID) *Backend6Key

func (*Backend6Key) DeepCopy added in v1.5.1

func (in *Backend6Key) DeepCopy() *Backend6Key

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Backend6Key.

func (*Backend6Key) DeepCopyInto added in v1.5.1

func (in *Backend6Key) DeepCopyInto(out *Backend6Key)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Backend6Key) DeepCopyMapKey added in v1.5.1

func (in *Backend6Key) DeepCopyMapKey() bpf.MapKey

DeepCopyMapKey is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapKey.

func (*Backend6Key) GetID added in v0.15.7

func (k *Backend6Key) GetID() loadbalancer.BackendID

func (*Backend6Key) GetKeyPtr added in v1.5.0

func (k *Backend6Key) GetKeyPtr() unsafe.Pointer

func (*Backend6Key) Map added in v0.15.7

func (k *Backend6Key) Map() *bpf.Map

func (*Backend6Key) NewValue added in v1.5.0

func (k *Backend6Key) NewValue() bpf.MapValue

func (*Backend6Key) SetID added in v0.15.7

func (k *Backend6Key) SetID(id loadbalancer.BackendID)

func (*Backend6Key) String added in v0.15.7

func (k *Backend6Key) String() string

type Backend6Value added in v0.15.7

type Backend6Value struct {
	Address types.IPv6      `align:"address"`
	Port    uint16          `align:"port"`
	Proto   u8proto.U8proto `align:"proto"`
	Pad     uint8           `align:"pad"`
}

Backend6Value must match 'struct lb6_backend' in "bpf/lib/common.h". +k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=github.com/cilium/cilium/pkg/bpf.MapValue

func NewBackend6Value added in v0.15.7

func NewBackend6Value(ip net.IP, port uint16, proto u8proto.U8proto) (*Backend6Value, error)

func (*Backend6Value) DeepCopy added in v1.5.1

func (in *Backend6Value) DeepCopy() *Backend6Value

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Backend6Value.

func (*Backend6Value) DeepCopyInto added in v1.5.1

func (in *Backend6Value) DeepCopyInto(out *Backend6Value)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Backend6Value) DeepCopyMapValue added in v1.5.1

func (in *Backend6Value) DeepCopyMapValue() bpf.MapValue

DeepCopyMapValue is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapValue.

func (*Backend6Value) GetAddress added in v0.15.7

func (b *Backend6Value) GetAddress() net.IP

func (*Backend6Value) GetPort added in v0.15.7

func (b *Backend6Value) GetPort() uint16

func (*Backend6Value) GetValuePtr added in v1.5.0

func (v *Backend6Value) GetValuePtr() unsafe.Pointer

func (*Backend6Value) String added in v0.15.7

func (v *Backend6Value) String() string

func (*Backend6Value) ToNetwork added in v0.15.7

func (v *Backend6Value) ToNetwork() BackendValue

type BackendKey added in v0.15.7

type BackendKey interface {
	bpf.MapKey

	// Return the BPF map matching the type
	Map() *bpf.Map

	// Set backend identifier
	SetID(loadbalancer.BackendID)

	// Get backend identifier
	GetID() loadbalancer.BackendID
}

BackendKey is the interface describing protocol independent backend key.

type BackendValue added in v0.15.7

type BackendValue interface {
	bpf.MapValue

	// Get backend address
	GetAddress() net.IP

	// Get backend port
	GetPort() uint16

	// Convert fields to network byte order.
	ToNetwork() BackendValue
}

BackendValue is the interface describing protocol independent backend value.

type LBBPFMap added in v0.15.7

type LBBPFMap struct{}

LBBPFMap is an implementation of the LBMap interface.

func (*LBBPFMap) AddBackend added in v0.15.7

func (*LBBPFMap) AddBackend(id uint16, ip net.IP, port uint16, ipv6 bool) error

AddBackend adds a backend into a BPF map.

func (*LBBPFMap) DeleteBackendByID added in v0.15.7

func (*LBBPFMap) DeleteBackendByID(id uint16, ipv6 bool) error

DeleteBackendByID removes a backend identified with the given ID from a BPF map.

func (*LBBPFMap) DeleteService added in v0.15.7

func (*LBBPFMap) DeleteService(svc loadbalancer.L3n4AddrID, backendCount int) error

DeleteService removes given service from a BPF map.

func (*LBBPFMap) DumpBackendMaps added in v0.15.7

func (*LBBPFMap) DumpBackendMaps() ([]*loadbalancer.Backend, error)

DumpBackendMaps dumps the backend entries from the BPF maps.

func (*LBBPFMap) DumpServiceMaps added in v0.15.7

func (*LBBPFMap) DumpServiceMaps() ([]*loadbalancer.SVC, []error)

DumpServiceMaps dumps the services from the BPF maps.

func (*LBBPFMap) UpsertService added in v0.15.7

func (*LBBPFMap) UpsertService(
	svcID uint16, svcIP net.IP, svcPort uint16,
	backendIDs []uint16, prevBackendCount int,
	ipv6 bool, svcType loadbalancer.SVCType, svcLocal bool) error

UpsertService inserts or updates the given service in a BPF map.

The corresponding backend entries (identified with the given backendIDs) have to exist before calling the function.

The given prevBackendCount denotes a previous service backend entries count, so that the function can remove obsolete ones.

type LBMockMap added in v1.7.0

type LBMockMap struct {
	BackendByID map[uint16]*lb.Backend
	ServiceByID map[uint16]*lb.SVC
}

func NewLBMockMap added in v1.7.0

func NewLBMockMap() *LBMockMap

func (*LBMockMap) AddBackend added in v1.7.0

func (m *LBMockMap) AddBackend(id uint16, ip net.IP, port uint16, ipv6 bool) error

func (*LBMockMap) DeleteBackendByID added in v1.7.0

func (m *LBMockMap) DeleteBackendByID(id uint16, ipv6 bool) error

func (*LBMockMap) DeleteService added in v1.7.0

func (m *LBMockMap) DeleteService(addr lb.L3n4AddrID, backendCount int) error

func (*LBMockMap) DumpBackendMaps added in v1.7.0

func (m *LBMockMap) DumpBackendMaps() ([]*lb.Backend, error)

func (*LBMockMap) DumpServiceMaps added in v1.7.0

func (m *LBMockMap) DumpServiceMaps() ([]*lb.SVC, []error)

func (*LBMockMap) UpsertService added in v1.7.0

func (m *LBMockMap) UpsertService(id uint16, ip net.IP, port uint16,
	backendIDs []uint16, prevCount int, ipv6 bool, svcType lb.SVCType,
	svcLocal bool) error

type RevNat4Key

type RevNat4Key struct {
	Key uint16
}

+k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=github.com/cilium/cilium/pkg/bpf.MapKey

func NewRevNat4Key

func NewRevNat4Key(value uint16) *RevNat4Key

func (*RevNat4Key) DeepCopy added in v1.5.1

func (in *RevNat4Key) DeepCopy() *RevNat4Key

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RevNat4Key.

func (*RevNat4Key) DeepCopyInto added in v1.5.1

func (in *RevNat4Key) DeepCopyInto(out *RevNat4Key)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*RevNat4Key) DeepCopyMapKey added in v1.5.1

func (in *RevNat4Key) DeepCopyMapKey() bpf.MapKey

DeepCopyMapKey is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapKey.

func (*RevNat4Key) GetKey

func (k *RevNat4Key) GetKey() uint16

func (*RevNat4Key) GetKeyPtr

func (k *RevNat4Key) GetKeyPtr() unsafe.Pointer

func (*RevNat4Key) Map

func (k *RevNat4Key) Map() *bpf.Map

func (*RevNat4Key) NewValue

func (k *RevNat4Key) NewValue() bpf.MapValue

func (*RevNat4Key) String

func (k *RevNat4Key) String() string

func (*RevNat4Key) ToNetwork added in v0.10.0

func (k *RevNat4Key) ToNetwork() RevNatKey

ToNetwork converts RevNat4Key to network byte order.

type RevNat4Value

type RevNat4Value struct {
	Address types.IPv4 `align:"address"`
	Port    uint16     `align:"port"`
}

+k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=github.com/cilium/cilium/pkg/bpf.MapValue

func NewRevNat4Value

func NewRevNat4Value(ip net.IP, port uint16) *RevNat4Value

func (*RevNat4Value) DeepCopy added in v1.5.1

func (in *RevNat4Value) DeepCopy() *RevNat4Value

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RevNat4Value.

func (*RevNat4Value) DeepCopyInto added in v1.5.1

func (in *RevNat4Value) DeepCopyInto(out *RevNat4Value)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*RevNat4Value) DeepCopyMapValue added in v1.5.1

func (in *RevNat4Value) DeepCopyMapValue() bpf.MapValue

DeepCopyMapValue is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapValue.

func (*RevNat4Value) GetValuePtr

func (v *RevNat4Value) GetValuePtr() unsafe.Pointer

func (*RevNat4Value) String

func (v *RevNat4Value) String() string

func (*RevNat4Value) ToNetwork added in v0.10.0

func (v *RevNat4Value) ToNetwork() RevNatValue

ToNetwork converts RevNat4Value to network byte order.

type RevNat6Key

type RevNat6Key struct {
	Key uint16
}

+k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=github.com/cilium/cilium/pkg/bpf.MapKey

func NewRevNat6Key

func NewRevNat6Key(value uint16) *RevNat6Key

func (*RevNat6Key) DeepCopy added in v1.5.1

func (in *RevNat6Key) DeepCopy() *RevNat6Key

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RevNat6Key.

func (*RevNat6Key) DeepCopyInto added in v1.5.1

func (in *RevNat6Key) DeepCopyInto(out *RevNat6Key)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*RevNat6Key) DeepCopyMapKey added in v1.5.1

func (in *RevNat6Key) DeepCopyMapKey() bpf.MapKey

DeepCopyMapKey is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapKey.

func (*RevNat6Key) GetKey

func (v *RevNat6Key) GetKey() uint16

func (*RevNat6Key) GetKeyPtr

func (v *RevNat6Key) GetKeyPtr() unsafe.Pointer

func (*RevNat6Key) Map

func (v *RevNat6Key) Map() *bpf.Map

func (*RevNat6Key) NewValue

func (v *RevNat6Key) NewValue() bpf.MapValue

func (*RevNat6Key) String

func (v *RevNat6Key) String() string

func (*RevNat6Key) ToNetwork added in v0.10.0

func (v *RevNat6Key) ToNetwork() RevNatKey

ToNetwork converts RevNat6Key to network byte order.

type RevNat6Value

type RevNat6Value struct {
	Address types.IPv6 `align:"address"`
	Port    uint16     `align:"port"`
}

+k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=github.com/cilium/cilium/pkg/bpf.MapValue

func NewRevNat6Value

func NewRevNat6Value(ip net.IP, port uint16) *RevNat6Value

func (*RevNat6Value) DeepCopy added in v1.5.1

func (in *RevNat6Value) DeepCopy() *RevNat6Value

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RevNat6Value.

func (*RevNat6Value) DeepCopyInto added in v1.5.1

func (in *RevNat6Value) DeepCopyInto(out *RevNat6Value)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*RevNat6Value) DeepCopyMapValue added in v1.5.1

func (in *RevNat6Value) DeepCopyMapValue() bpf.MapValue

DeepCopyMapValue is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapValue.

func (*RevNat6Value) GetValuePtr

func (v *RevNat6Value) GetValuePtr() unsafe.Pointer

func (*RevNat6Value) String

func (v *RevNat6Value) String() string

func (*RevNat6Value) ToNetwork added in v0.10.0

func (v *RevNat6Value) ToNetwork() RevNatValue

ToNetwork converts RevNat6Value to network byte order.

type RevNatKey

type RevNatKey interface {
	bpf.MapKey

	// Returns the BPF map matching the key type
	Map() *bpf.Map

	// ToNetwork converts fields to network byte order.
	ToNetwork() RevNatKey

	// Returns the key value
	GetKey() uint16
}

type RevNatValue

type RevNatValue interface {
	bpf.MapValue

	// ToNetwork converts fields to network byte order.
	ToNetwork() RevNatValue
}

type Service4Key

type Service4Key struct {
	Address types.IPv4 `align:"address"`
	Port    uint16     `align:"dport"`
	Slave   uint16     `align:"slave"`
	Proto   uint8      `align:"proto"`
	Pad     pad3uint8  `align:"pad"`
}

Service4Key must match 'struct lb4_key_v2' in "bpf/lib/common.h". +k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=github.com/cilium/cilium/pkg/bpf.MapKey

func NewService4Key

func NewService4Key(ip net.IP, port uint16, proto u8proto.U8proto, slave uint16) *Service4Key

func (*Service4Key) DeepCopy added in v1.5.1

func (in *Service4Key) DeepCopy() *Service4Key

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Service4Key.

func (*Service4Key) DeepCopyInto added in v1.5.1

func (in *Service4Key) DeepCopyInto(out *Service4Key)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Service4Key) DeepCopyMapKey added in v1.5.1

func (in *Service4Key) DeepCopyMapKey() bpf.MapKey

DeepCopyMapKey is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapKey.

func (*Service4Key) GetAddress added in v0.15.7

func (k *Service4Key) GetAddress() net.IP

func (*Service4Key) GetKeyPtr

func (k *Service4Key) GetKeyPtr() unsafe.Pointer

func (*Service4Key) GetPort

func (k *Service4Key) GetPort() uint16

func (*Service4Key) GetSlave added in v1.7.0

func (k *Service4Key) GetSlave() int

func (*Service4Key) IsIPv6

func (k *Service4Key) IsIPv6() bool

func (*Service4Key) Map

func (k *Service4Key) Map() *bpf.Map

func (*Service4Key) MapDelete

func (k *Service4Key) MapDelete() error

func (*Service4Key) NewValue

func (k *Service4Key) NewValue() bpf.MapValue

func (*Service4Key) RevNatValue

func (k *Service4Key) RevNatValue() RevNatValue

func (*Service4Key) SetSlave added in v1.7.0

func (k *Service4Key) SetSlave(slave int)

func (*Service4Key) String

func (k *Service4Key) String() string

func (*Service4Key) ToNetwork added in v0.10.0

func (k *Service4Key) ToNetwork() ServiceKey

type Service4Value

type Service4Value struct {
	BackendID uint32 `align:"backend_id"`
	Count     uint16 `align:"count"`
	RevNat    uint16 `align:"rev_nat_index"`
	Flags     uint8
	Pad       pad3uint8 `align:"pad"`
}

Service4Value must match 'struct lb4_service_v2' in "bpf/lib/common.h". +k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=github.com/cilium/cilium/pkg/bpf.MapValue

func NewService4Value

func NewService4Value(count uint16, backendID loadbalancer.BackendID, revNat uint16) *Service4Value

func (*Service4Value) DeepCopy added in v1.5.1

func (in *Service4Value) DeepCopy() *Service4Value

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Service4Value.

func (*Service4Value) DeepCopyInto added in v1.5.1

func (in *Service4Value) DeepCopyInto(out *Service4Value)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Service4Value) DeepCopyMapValue added in v1.5.1

func (in *Service4Value) DeepCopyMapValue() bpf.MapValue

DeepCopyMapValue is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapValue.

func (*Service4Value) GetBackendID added in v0.15.7

func (s *Service4Value) GetBackendID() loadbalancer.BackendID

func (*Service4Value) GetCount

func (s *Service4Value) GetCount() int

func (*Service4Value) GetFlags added in v0.15.7

func (s *Service4Value) GetFlags() uint8

func (*Service4Value) GetRevNat added in v0.15.7

func (s *Service4Value) GetRevNat() int

func (*Service4Value) GetValuePtr

func (s *Service4Value) GetValuePtr() unsafe.Pointer

func (*Service4Value) RevNatKey

func (s *Service4Value) RevNatKey() RevNatKey

func (*Service4Value) SetBackendID added in v0.15.7

func (s *Service4Value) SetBackendID(id loadbalancer.BackendID)

func (*Service4Value) SetCount

func (s *Service4Value) SetCount(count int)

func (*Service4Value) SetFlags added in v0.15.7

func (s *Service4Value) SetFlags(flags uint8)

func (*Service4Value) SetRevNat

func (s *Service4Value) SetRevNat(id int)

func (*Service4Value) String

func (s *Service4Value) String() string

func (*Service4Value) ToNetwork added in v0.10.0

func (s *Service4Value) ToNetwork() ServiceValue

type Service6Key

type Service6Key struct {
	Address types.IPv6 `align:"address"`
	Port    uint16     `align:"dport"`
	Slave   uint16     `align:"slave"`
	Proto   uint8      `align:"proto"`
	Pad     pad3uint8  `align:"pad"`
}

Service6Key must match 'struct lb6_key_v2' in "bpf/lib/common.h". +k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=github.com/cilium/cilium/pkg/bpf.MapKey

func NewService6Key

func NewService6Key(ip net.IP, port uint16, proto u8proto.U8proto, slave uint16) *Service6Key

func (*Service6Key) DeepCopy added in v1.5.1

func (in *Service6Key) DeepCopy() *Service6Key

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Service6Key.

func (*Service6Key) DeepCopyInto added in v1.5.1

func (in *Service6Key) DeepCopyInto(out *Service6Key)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Service6Key) DeepCopyMapKey added in v1.5.1

func (in *Service6Key) DeepCopyMapKey() bpf.MapKey

DeepCopyMapKey is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapKey.

func (*Service6Key) GetAddress added in v0.15.7

func (k *Service6Key) GetAddress() net.IP

func (*Service6Key) GetKeyPtr

func (k *Service6Key) GetKeyPtr() unsafe.Pointer

func (*Service6Key) GetPort

func (k *Service6Key) GetPort() uint16

func (*Service6Key) GetSlave added in v1.7.0

func (k *Service6Key) GetSlave() int

func (*Service6Key) IsIPv6

func (k *Service6Key) IsIPv6() bool

func (*Service6Key) Map

func (k *Service6Key) Map() *bpf.Map

func (*Service6Key) MapDelete added in v0.15.7

func (k *Service6Key) MapDelete() error

func (*Service6Key) NewValue

func (k *Service6Key) NewValue() bpf.MapValue

func (*Service6Key) RevNatValue

func (k *Service6Key) RevNatValue() RevNatValue

func (*Service6Key) SetSlave added in v1.7.0

func (k *Service6Key) SetSlave(slave int)

func (*Service6Key) String

func (k *Service6Key) String() string

func (*Service6Key) ToNetwork added in v0.10.0

func (k *Service6Key) ToNetwork() ServiceKey

type Service6Value

type Service6Value struct {
	BackendID uint32 `align:"backend_id"`
	Count     uint16 `align:"count"`
	RevNat    uint16 `align:"rev_nat_index"`
	Flags     uint8
	Pad       pad3uint8 `align:"pad"`
}

Service6Value must match 'struct lb6_service_v2' in "bpf/lib/common.h". +k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=github.com/cilium/cilium/pkg/bpf.MapValue

func NewService6Value

func NewService6Value(count uint16, backendID loadbalancer.BackendID, revNat uint16) *Service6Value

func (*Service6Value) DeepCopy added in v1.5.1

func (in *Service6Value) DeepCopy() *Service6Value

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Service6Value.

func (*Service6Value) DeepCopyInto added in v1.5.1

func (in *Service6Value) DeepCopyInto(out *Service6Value)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Service6Value) DeepCopyMapValue added in v1.5.1

func (in *Service6Value) DeepCopyMapValue() bpf.MapValue

DeepCopyMapValue is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapValue.

func (*Service6Value) GetBackendID added in v0.15.7

func (s *Service6Value) GetBackendID() loadbalancer.BackendID

func (*Service6Value) GetCount

func (s *Service6Value) GetCount() int

func (*Service6Value) GetFlags added in v0.15.7

func (s *Service6Value) GetFlags() uint8

func (*Service6Value) GetRevNat added in v0.15.7

func (s *Service6Value) GetRevNat() int

func (*Service6Value) GetValuePtr

func (s *Service6Value) GetValuePtr() unsafe.Pointer

func (*Service6Value) RevNatKey

func (s *Service6Value) RevNatKey() RevNatKey

func (*Service6Value) SetBackendID added in v0.15.7

func (s *Service6Value) SetBackendID(id loadbalancer.BackendID)

func (*Service6Value) SetCount

func (s *Service6Value) SetCount(count int)

func (*Service6Value) SetFlags added in v0.15.7

func (s *Service6Value) SetFlags(flags uint8)

func (*Service6Value) SetRevNat

func (s *Service6Value) SetRevNat(id int)

func (*Service6Value) String

func (s *Service6Value) String() string

func (*Service6Value) ToNetwork added in v0.10.0

func (s *Service6Value) ToNetwork() ServiceValue

type ServiceKey

type ServiceKey interface {
	bpf.MapKey

	// Return true if the key is of type IPv6
	IsIPv6() bool

	// Return the BPF map matching the key type
	Map() *bpf.Map

	// Set slave slot for the key
	SetSlave(slave int)

	// Get slave slot of the key
	GetSlave() int

	// Get frontend IP address
	GetAddress() net.IP

	// Get frontend port
	GetPort() uint16

	// Returns a RevNatValue matching a ServiceKey
	RevNatValue() RevNatValue

	// Delete entry identified with the key from the matching map
	MapDelete() error

	// ToNetwork converts fields to network byte order.
	ToNetwork() ServiceKey
}

ServiceKey is the interface describing protocol independent 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 reverse NAT identifier
	SetRevNat(int)

	// Get reverse NAT identifier
	GetRevNat() int

	// Set flags
	SetFlags(uint8)

	// Get flags
	GetFlags() uint8

	// 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
}

ServiceValue is the interface describing protocol independent value for services map v2.

Jump to

Keyboard shortcuts

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