Documentation ¶
Index ¶
- Constants
- Variables
- func MapMemIter(m MapMem) func(k, v []byte)
- func MapMemIterV6(m MapMemV6) func(k, v []byte)
- type EntryData
- type Key
- type KeyInterface
- type KeyV6
- type Leg
- type MapMem
- type MapMemV6
- type Value
- func NewValueNATForward(created, lastSeen time.Duration, flags uint16, revKey Key) Value
- func NewValueNATReverse(created, lastSeen time.Duration, flags uint16, legA, legB Leg, ...) Value
- func NewValueNATReverseSNAT(created, lastSeen time.Duration, flags uint16, legA, legB Leg, ...) Value
- func NewValueNormal(created, lastSeen time.Duration, flags uint16, legA, legB Leg) Value
- func (e Value) AsBytes() []byte
- func (e Value) Created() int64
- func (e Value) Data() EntryData
- func (e Value) Flags() uint16
- func (e Value) IsForwardDSR() bool
- func (e Value) LastSeen() int64
- func (e Value) NATSPort() uint16
- func (e Value) OrigIP() net.IP
- func (e Value) OrigPort() uint16
- func (e Value) OrigSPort() uint16
- func (e Value) OrigSrcIP() net.IP
- func (e Value) ReverseNATKey() KeyInterface
- func (e *Value) SetLegA2B(leg Leg)
- func (e *Value) SetLegB2A(leg Leg)
- func (e *Value) SetNATSport(sport uint16)
- func (e *Value) SetOrigSport(sport uint16)
- func (e Value) String() string
- func (e Value) Type() uint8
- func (e Value) Upgrade() maps.Upgradable
- type ValueInterface
- type ValueV6
- func NewValueV6NATForward(created, lastSeen time.Duration, flags uint16, revKey KeyV6) ValueV6
- func NewValueV6NATReverse(created, lastSeen time.Duration, flags uint16, legA, legB Leg, ...) ValueV6
- func NewValueV6NATReverseSNAT(created, lastSeen time.Duration, flags uint16, legA, legB Leg, ...) ValueV6
- func NewValueV6Normal(created, lastSeen time.Duration, flags uint16, legA, legB Leg) ValueV6
- func (e ValueV6) AsBytes() []byte
- func (e ValueV6) Created() int64
- func (e ValueV6) Data() EntryData
- func (e ValueV6) Flags() uint16
- func (e ValueV6) IsForwardDSR() bool
- func (e ValueV6) LastSeen() int64
- func (e ValueV6) NATSPort() uint16
- func (e ValueV6) OrigIP() net.IP
- func (e ValueV6) OrigPort() uint16
- func (e ValueV6) OrigSPort() uint16
- func (e ValueV6) OrigSrcIP() net.IP
- func (e ValueV6) ReverseNATKey() KeyInterface
- func (e *ValueV6) SetLegA2B(leg Leg)
- func (e *ValueV6) SetLegB2A(leg Leg)
- func (e *ValueV6) SetNATSport(sport uint16)
- func (e *ValueV6) SetOrigSport(sport uint16)
- func (e ValueV6) String() string
- func (e ValueV6) Type() uint8
- func (e ValueV6) Upgrade() maps.Upgradable
Constants ¶
const ( VoCreated int = 0 VoLastSeen int = 8 VoType int = 16 VoFlags int = 17 VoFlags2 int = 23 VoRevKey int = 24 VoLegAB int = 24 VoLegBA int = 48 VoOrigIP int = 76 VoOrigPort int = 80 VoOrigSPort int = 82 VoOrigSIP int = 84 VoTunIP int = 72 VoNATSPort int = 40 )
const ( TypeNormal uint8 = iota TypeNATForward TypeNATReverse FlagNATOut uint16 = (1 << 0) FlagNATFwdDsr uint16 = (1 << 1) FlagNATNPFwd uint16 = (1 << 2) FlagSkipFIB uint16 = (1 << 3) FlagReserved4 uint16 = (1 << 4) FlagReserved5 uint16 = (1 << 5) FlagExtLocal uint16 = (1 << 6) FlagViaNATIf uint16 = (1 << 7) FlagSrcDstBA uint16 = (1 << 8) FlagHostPSNAT uint16 = (1 << 9) FlagSvcSelf uint16 = (1 << 10) FlagNPLoop uint16 = (1 << 11) FlagNPRemote uint16 = (1 << 12) FlagNoDSR uint16 = (1 << 13) )
const ( VoCreatedV6 int = 0 VoLastSeenV6 int = 8 VoTypeV6 int = 16 VoFlagsV6 int = 17 VoFlags2V6 int = 23 VoRevKeyV6 int = 24 VoLegABV6 int = 24 VoLegBAV6 int = 48 VoTunIPV6 int = 72 VoOrigIPV6 int = VoTunIPV6 + 16 VoOrigPortV6 int = VoOrigIPV6 + 16 VoOrigSPortV6 int = VoOrigPortV6 + 2 VoOrigSIPV6 int = VoOrigSPortV6 + 2 VoNATSPortV6 int = VoRevKeyV6 + KeyV6Size )
const KeySize = 16
struct calico_ct_key { uint32_t protocol; __be32 addr_a, addr_b; // NBO uint16_t port_a, port_b; // HBO };
const KeyV6Size = 40
struct calico_ct_key { uint32_t protocol; __be32 addr_a, addr_b; // NBO uint16_t port_a, port_b; // HBO };
const MaxEntries = 512000
const ValueSize = 88
const ValueV6Size = 128
Variables ¶
var MapParams = maps.MapParameters{ Type: "hash", KeySize: KeySize, ValueSize: ValueSize, MaxEntries: MaxEntries, Name: "cali_v4_ct", Flags: unix.BPF_F_NO_PREALLOC, Version: 3, UpdatedByBPF: true, }
var MapParamsV6 = maps.MapParameters{ Type: "hash", KeySize: KeyV6Size, ValueSize: ValueV6Size, MaxEntries: MaxEntries, Name: "cali_v6_ct", Flags: unix.BPF_F_NO_PREALLOC, Version: 3, UpdatedByBPF: true, }
Functions ¶
func MapMemIter ¶
MapMemIter returns maps.MapIter that loads the provided MapMem
func MapMemIterV6 ¶
MapMemIterV6 returns maps.MapIter that loads the provided MapMemV6
Types ¶
type EntryData ¶
type EntryData struct { A2B Leg B2A Leg OrigDst net.IP OrigSrc net.IP OrigPort uint16 OrigSPort uint16 TunIP net.IP }
func (EntryData) Established ¶
func (EntryData) FINsSeenDSR ¶
type KeyInterface ¶
type KeyInterface interface { Proto() uint8 AddrA() net.IP PortA() uint16 AddrB() net.IP PortB() uint16 String() string AsBytes() []byte }
func KeyFromBytes ¶
func KeyFromBytes(k []byte) KeyInterface
func KeyV6FromBytes ¶
func KeyV6FromBytes(k []byte) KeyInterface
type Leg ¶
type Leg struct { Bytes uint64 Packets uint32 Seqno uint32 SynSeen bool AckSeen bool FinSeen bool RstSeen bool Approved bool Opener bool Ifindex uint32 }
type Value ¶
func NewValueNATForward ¶
NewValueNATForward creates a new Value of type TypeNATForward for the given arguments and the reverse key
func NewValueNATReverse ¶
func NewValueNATReverse(created, lastSeen time.Duration, flags uint16, legA, legB Leg, tunnelIP, origIP net.IP, origPort uint16) Value
NewValueNATReverse creates a new Value of type TypeNATReverse for the given arguments and reverse parameters
func NewValueNATReverseSNAT ¶
func NewValueNATReverseSNAT(created, lastSeen time.Duration, flags uint16, legA, legB Leg, tunnelIP, origIP, origSrcIP net.IP, origPort uint16) Value
NewValueNATReverseSNAT in addition to NewValueNATReverse sets the orig source IP
func NewValueNormal ¶
NewValueNormal creates a new Value of type TypeNormal based on the given parameters
func (Value) IsForwardDSR ¶
func (Value) NATSPort ¶
NATSPort returns the port to SNAT to, valid only if Type() is TypeNATForward.
func (Value) OrigIP ¶
OrigIP returns the original destination IP, valid only if Type() is TypeNormal or TypeNATReverse
func (Value) OrigPort ¶
OrigPort returns the original destination port, valid only if Type() is TypeNormal or TypeNATReverse
func (Value) OrigSPort ¶
OrigSPort returns the original source port, valid only if Type() is TypeNATReverse and if the value returned is non-zero.
func (Value) ReverseNATKey ¶
func (e Value) ReverseNATKey() KeyInterface
func (*Value) SetNATSport ¶
func (*Value) SetOrigSport ¶
func (Value) Upgrade ¶
func (e Value) Upgrade() maps.Upgradable
type ValueInterface ¶
type ValueInterface interface { Created() int64 LastSeen() int64 Type() uint8 Flags() uint16 OrigIP() net.IP OrigPort() uint16 OrigSPort() uint16 NATSPort() uint16 OrigSrcIP() net.IP ReverseNATKey() KeyInterface AsBytes() []byte Data() EntryData IsForwardDSR() bool String() string }
func ValueFromBytes ¶
func ValueFromBytes(v []byte) ValueInterface
func ValueV6FromBytes ¶
func ValueV6FromBytes(v []byte) ValueInterface
type ValueV6 ¶
type ValueV6 [ValueV6Size]byte
func NewValueV6NATForward ¶
NewValueV6NATForward creates a new ValueV6 of type TypeNATForward for the given arguments and the reverse key
func NewValueV6NATReverse ¶
func NewValueV6NATReverse(created, lastSeen time.Duration, flags uint16, legA, legB Leg, tunnelIP, origIP net.IP, origPort uint16) ValueV6
NewValueV6NATReverse creates a new ValueV6 of type TypeNATReverse for the given arguments and reverse parameters
func NewValueV6NATReverseSNAT ¶
func NewValueV6NATReverseSNAT(created, lastSeen time.Duration, flags uint16, legA, legB Leg, tunnelIP, origIP, origSrcIP net.IP, origPort uint16) ValueV6
NewValueV6NATReverseSNAT in addition to NewValueV6NATReverse sets the orig source IP
func NewValueV6Normal ¶
NewValueV6Normal creates a new ValueV6 of type TypeNormal based on the given parameters
func (ValueV6) IsForwardDSR ¶
func (ValueV6) NATSPort ¶
NATSPort returns the port to SNAT to, valid only if Type() is TypeNATForward.
func (ValueV6) OrigIP ¶
OrigIP returns the original destination IP, valid only if Type() is TypeNormal or TypeNATReverse
func (ValueV6) OrigPort ¶
OrigPort returns the original destination port, valid only if Type() is TypeNormal or TypeNATReverse
func (ValueV6) OrigSPort ¶
OrigSPort returns the original source port, valid only if Type() is TypeNATReverse and if the value returned is non-zero.
func (ValueV6) ReverseNATKey ¶
func (e ValueV6) ReverseNATKey() KeyInterface
func (*ValueV6) SetNATSport ¶
func (*ValueV6) SetOrigSport ¶
func (ValueV6) Upgrade ¶
func (e ValueV6) Upgrade() maps.Upgradable