ipsets

package
v0.0.0-...-21cfbab Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0, Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

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

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

Functions

func Map

func Map() maps.Map

func NewBPFIPSets

func NewBPFIPSets(
	ipVersionConfig *ipsets.IPVersionConfig,
	ipSetIDAllocator *idalloc.IDAllocator,
	ipSetsMap maps.Map,
	opRecorder logutils.OpRecorder,
) *bpfIPSets

func SetMapSize

func SetMapSize(size int)

Types

type IPSetEntry

type IPSetEntry [IPSetEntrySize]byte

func MakeBPFIPSetEntry

func MakeBPFIPSetEntry(setID uint64, cidr ip.V4CIDR, port uint16, proto uint8) *IPSetEntry

func ProtoIPSetMemberToBPFEntry

func ProtoIPSetMemberToBPFEntry(id uint64, member string) *IPSetEntry

func (IPSetEntry) Addr

func (e IPSetEntry) Addr() net.IP

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

Jump to

Keyboard shortcuts

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