Documentation ¶
Index ¶
- Constants
- Variables
- func Map() maps.Map
- func MapMemIter(m MapMem) func(k, v []byte)
- func MapMemV6Iter(m MapMemV6) func(k, v []byte)
- func MapV6() maps.Map
- func NewBPFIPSets(ipVersionConfig *ipsets.IPVersionConfig, ipSetIDAllocator *idalloc.IDAllocator, ...) *bpfIPSets
- func SetMapSize(size int)
- func SetMapV6Size(size int)
- type IPSetEntry
- type IPSetEntryInterface
- func IPSetEntryFromBytes(b []byte) IPSetEntryInterface
- func IPSetEntryV6FromBytes(b []byte) IPSetEntryInterface
- func MakeBPFIPSetEntry(setID uint64, cidr ip.V4CIDR, port uint16, proto uint8) IPSetEntryInterface
- func MakeBPFIPSetEntryV6(setID uint64, cidr ip.V6CIDR, port uint16, proto uint8) IPSetEntryInterface
- func ProtoIPSetMemberToBPFEntry(id uint64, member string) IPSetEntryInterface
- func ProtoIPSetMemberToBPFEntryV6(id uint64, member string) IPSetEntryInterface
- type IPSetEntryV6
- type MapMem
- type MapMemV6
Constants ¶
View Source
const IPSetEntrySize = 20
WARNING: must be kept in sync with the definitions in bpf/polprog/pol_prog_builder.go. WARNING: must be kept in sync with the definitions in bpf/include/policy.h. uint32 prefixLen HE 4 uint64 set_id BE +8 = 12 uint32 addr BE +4 = 16 uint16 port HE +2 = 18 uint8 proto +1 = 19 uint8 pad +1 = 20
View Source
const IPSetEntryV6Size = 32
WARNING: must be kept in sync with the definitions in bpf/polprog/pol_prog_builder.go. WARNING: must be kept in sync with the definitions in bpf/include/policy.h. uint32 prefixLen HE 4 uint64 set_id BE +8 = 12 4*uint32 addr BE +16 = 28 uint16 port HE +2 = 30 uint8 proto +1 = 31 uint8 pad +1 = 32
Variables ¶
View Source
var DummyValue = []byte{1, 0, 0, 0}
View Source
var MapParameters = maps.MapParameters{ Type: "lpm_trie", KeySize: IPSetEntrySize, ValueSize: 4, MaxEntries: 1024 * 1024, Name: "cali_v4_ip_sets", Flags: unix.BPF_F_NO_PREALLOC, }
View Source
var MapV6Parameters = maps.MapParameters{ Type: "lpm_trie", KeySize: IPSetEntryV6Size, ValueSize: 4, MaxEntries: 1024 * 1024, Name: "cali_v6_ip_sets", Flags: unix.BPF_F_NO_PREALLOC, }
Functions ¶
func MapMemIter ¶
func MapMemV6Iter ¶
func NewBPFIPSets ¶
func NewBPFIPSets( ipVersionConfig *ipsets.IPVersionConfig, ipSetIDAllocator *idalloc.IDAllocator, ipSetsMap maps.Map, entryFromBytes func([]byte) IPSetEntryInterface, protoIPSetMemberToBPFEntry func(uint64, string) IPSetEntryInterface, opRecorder logutils.OpRecorder, ) *bpfIPSets
func SetMapSize ¶
func SetMapSize(size int)
func SetMapV6Size ¶
func SetMapV6Size(size int)
Types ¶
type IPSetEntry ¶
type IPSetEntry [IPSetEntrySize]byte
func (IPSetEntry) Addr ¶
func (e IPSetEntry) Addr() net.IP
func (IPSetEntry) AsBytes ¶
func (e IPSetEntry) AsBytes() []byte
func (IPSetEntry) Port ¶
func (e IPSetEntry) Port() uint16
func (IPSetEntry) PrefixLen ¶
func (e IPSetEntry) PrefixLen() uint32
func (IPSetEntry) Protocol ¶
func (e IPSetEntry) Protocol() uint8
func (IPSetEntry) SetID ¶
func (e IPSetEntry) SetID() uint64
func (IPSetEntry) String ¶
func (e IPSetEntry) String() string
type IPSetEntryInterface ¶
type IPSetEntryInterface interface { SetID() uint64 Addr() net.IP PrefixLen() uint32 Protocol() uint8 Port() uint16 AsBytes() []byte }
func IPSetEntryFromBytes ¶
func IPSetEntryFromBytes(b []byte) IPSetEntryInterface
func IPSetEntryV6FromBytes ¶
func IPSetEntryV6FromBytes(b []byte) IPSetEntryInterface
func MakeBPFIPSetEntry ¶
func MakeBPFIPSetEntryV6 ¶
func ProtoIPSetMemberToBPFEntry ¶
func ProtoIPSetMemberToBPFEntry(id uint64, member string) IPSetEntryInterface
func ProtoIPSetMemberToBPFEntryV6 ¶
func ProtoIPSetMemberToBPFEntryV6(id uint64, member string) IPSetEntryInterface
type IPSetEntryV6 ¶
type IPSetEntryV6 [IPSetEntryV6Size]byte
func (IPSetEntryV6) Addr ¶
func (e IPSetEntryV6) Addr() net.IP
func (IPSetEntryV6) AsBytes ¶
func (e IPSetEntryV6) AsBytes() []byte
func (IPSetEntryV6) Port ¶
func (e IPSetEntryV6) Port() uint16
func (IPSetEntryV6) PrefixLen ¶
func (e IPSetEntryV6) PrefixLen() uint32
func (IPSetEntryV6) Protocol ¶
func (e IPSetEntryV6) Protocol() uint8
func (IPSetEntryV6) SetID ¶
func (e IPSetEntryV6) SetID() uint64
func (IPSetEntryV6) String ¶
func (e IPSetEntryV6) String() string
type MapMem ¶
type MapMem map[IPSetEntry]struct{}
Click to show internal directories.
Click to hide internal directories.