Documentation
¶
Overview ¶
Package nat implements the BPF NAT map interaction code.
Index ¶
Constants ¶
View Source
const ( // MapNameSnat4Global represents global IPv4 NAT table. MapNameSnat4Global = "cilium_snat_v4_external" // MapNameSnat6Global represents global IPv6 NAT table. MapNameSnat6Global = "cilium_snat_v6_external" // MinPortSnatDefault represents default min port from range. MinPortSnatDefault = 1024 // MaxPortSnatDefault represents default max port from range. MaxPortSnatDefault = 65535 // CollisionRetriesDefault defines maximum retries for resolving port collisions. CollisionRetriesDefault = 16 // DeterministicRetriesDefault defines maximum deterministic retries for // resolving port collisions. DeterministicRetriesDefault = 6 // MaxEntries defines maximum NAT entries. MaxEntries = 524288 )
Variables ¶
This section is empty.
Functions ¶
func NatDumpCreated ¶
NatDumpCreated returns time in seconds when NAT entry was created.
Types ¶
type Map ¶
Map represents a NAT map.
func (*Map) DeleteMapping ¶
DeleteMapping removes a NAT mapping from the global NAT table.
func (*Map) DumpEntries ¶
DumpEntries iterates through Map m and writes the values of the nat entries in m to a string.
type NatEntry ¶
type NatEntry interface {
bpf.MapValue
// ToHost converts fields to host byte order.
ToHost() NatEntry
// Dumps the Nat entry as string.
Dump(key tuple.TupleKey, start uint64) string
}
NatEntry is the interface describing values to the NAT map.
type NatEntry4 ¶
type NatEntry4 struct {
Created uint64 `align:"created"`
HostLocal uint64 `align:"host_local"`
Pad1 uint64 `align:"pad1"`
Pad2 uint64 `align:"pad2"`
Addr types.IPv4 `align:"to_saddr"`
Port uint16 `align:"to_sport"`
}
NatEntry4 represents an IPv4 entry in the NAT table.
func (*NatEntry4) GetValuePtr ¶
GetValuePtr returns the unsafe.Pointer for n.
type NatEntry6 ¶
type NatEntry6 struct {
Created uint64 `align:"created"`
HostLocal uint64 `align:"host_local"`
Pad1 uint64 `align:"pad1"`
Pad2 uint64 `align:"pad2"`
Addr types.IPv6 `align:"to_saddr"`
Port uint16 `align:"to_sport"`
}
NatEntry6 represents an IPv6 entry in the NAT table.
func (*NatEntry6) GetValuePtr ¶
GetValuePtr returns the unsafe.Pointer for n.
Click to show internal directories.
Click to hide internal directories.