routes

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: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagInIPAMPool  Flags = 0x01
	FlagNATOutgoing Flags = 0x02
	FlagWorkload    Flags = 0x04
	FlagLocal       Flags = 0x08
	FlagHost        Flags = 0x10
	FlagSameSubnet  Flags = 0x20
	FlagTunneled    Flags = 0x40
	FlagNoDSR       Flags = 0x80

	FlagsUnknown            Flags = 0
	FlagsRemoteWorkload           = FlagWorkload
	FlagsRemoteHost               = FlagHost
	FlagsLocalHost                = FlagLocal | FlagHost
	FlagsLocalWorkload            = FlagLocal | FlagWorkload
	FlagsRemoteTunneledHost       = FlagsRemoteHost | FlagTunneled
	FlagsLocalTunneledHost        = FlagsLocalHost | FlagTunneled
)
View Source
const KeySize = 8

struct cali_rt_key { __u32 mask; __be32 addr; // NBO };

View Source
const ValueSize = 8
struct cali_rt_value {
  __u32 flags;
  union {
    __u32 next_hop;
    __u32 ifIndex;
  };
};

Variables

View Source
var MapParameters = maps.MapParameters{
	Type:       "lpm_trie",
	KeySize:    KeySize,
	ValueSize:  ValueSize,
	MaxEntries: 256 * 1024,
	Name:       "cali_v4_routes",
	Flags:      unix.BPF_F_NO_PREALLOC,
}

Functions

func Map

func Map() maps.Map

func SetMapSize

func SetMapSize(size int)

Types

type Flags

type Flags uint32

type Key

type Key [KeySize]byte

func NewKey

func NewKey(cidr ip.V4CIDR) Key

func (Key) Addr

func (k Key) Addr() ip.Addr

func (Key) AsBytes

func (k Key) AsBytes() []byte

func (Key) Dest

func (k Key) Dest() ip.CIDR

func (Key) PrefixLen

func (k Key) PrefixLen() int

type LPMv4

type LPMv4 struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewLPMv4

func NewLPMv4() *LPMv4

func (*LPMv4) Delete

func (lpm *LPMv4) Delete(k Key) error

func (*LPMv4) Lookup

func (lpm *LPMv4) Lookup(addr ip.V4Addr) (Value, bool)

func (*LPMv4) Update

func (lpm *LPMv4) Update(k Key, v Value) error

type MapMem

type MapMem map[Key]Value

func LoadMap

func LoadMap(rtm maps.Map) (MapMem, error)

LoadMap loads a routes.Map into memory

type Value

type Value [ValueSize]byte

func NewValue

func NewValue(flags Flags) Value

func NewValueWithIfIndex

func NewValueWithIfIndex(flags Flags, ifIndex int) Value

func NewValueWithNextHop

func NewValueWithNextHop(flags Flags, nextHop ip.V4Addr) Value

func (Value) AsBytes

func (v Value) AsBytes() []byte

func (Value) Flags

func (v Value) Flags() Flags

func (Value) IfaceIndex

func (v Value) IfaceIndex() uint32

func (Value) NextHop

func (v Value) NextHop() ip.Addr

func (Value) String

func (v Value) String() string

Jump to

Keyboard shortcuts

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