Documentation ¶
Index ¶
- Constants
- Variables
- func CheckHWOffloading() bool
- func CloseAllDumpFiles()
- func InitFlows()
- func OptionsLen(options layers.DHCPv6Options) int
- func ParseAllKnownL4(pkt *packet.Packet, pktIPv4 *packet.IPv4Hdr, pktIPv6 *packet.IPv6Hdr) (uint8, *packet.TCPHdr, *packet.UDPHdr, *packet.ICMPHdr, uint16, uint16)
- func PrivateToPublicTranslation(pkt *packet.Packet, ctx flow.UserContext) uint
- func PublicToPrivateTranslation(pkt *packet.Packet, ctx flow.UserContext) uint
- func ReadConfig(fileName string, setKniIP, bringUpKniInterfaces bool) error
- func StartDHCPClient()
- func StartGRPCServer() error
- func StringIPv4Int(addr uint32) string
- type Config
- type DHCPv6FQDN
- type DHCPv6FQDNFlags
- type DHCPv6IAAddress
- type DHCPv6IANA
- type DHCPv6ServerStatusCode
- type Tuple
- type Tuple6
Constants ¶
View Source
const ( DirDROP = uint(upd.TraceType_DUMP_DROP) DirSEND = uint(upd.TraceType_DUMP_TRANSLATE) DirKNI = uint(upd.TraceType_DUMP_KNI) )
View Source
const ( DHCPServerPort = 67 DHCPClientPort = 68 BroadcastIPv4 = types.IPv4Address(0xffffffff) )
View Source
const ( DHCPv6ClientPort = 546 DHCPv6ServerPort = 547 )
View Source
const (
GRPCServerPort = ":60602"
)
Variables ¶
View Source
var ( // Natconfig is a config file. Natconfig *Config // CalculateChecksum is a flag whether checksums should be // calculated for modified packets. NoCalculateChecksum bool // HWTXChecksum is a flag whether checksums calculation should be // offloaded to HW. NoHWTXChecksum bool NeedKNI bool NeedDHCP bool // Debug variables DumpEnabled [DirKNI + 1]bool )
View Source
var ( BroadcastIPv6 = types.IPv6Address{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, } SingleIPMask = types.IPv6Address{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, } SingleIPNetMask = net.CIDRMask(128, 128) )
View Source
var (
BroadcastMAC = types.MACAddress{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
)
Functions ¶
func CheckHWOffloading ¶
func CheckHWOffloading() bool
func OptionsLen ¶
func OptionsLen(options layers.DHCPv6Options) int
Returns length of data portion of option (excluding IANA code 3 and option length)
func ParseAllKnownL4 ¶
func PrivateToPublicTranslation ¶
func PrivateToPublicTranslation(pkt *packet.Packet, ctx flow.UserContext) uint
PrivateToPublicTranslation does egress translation.
func PublicToPrivateTranslation ¶
func PublicToPrivateTranslation(pkt *packet.Packet, ctx flow.UserContext) uint
PublicToPrivateTranslation does ingress translation.
func ReadConfig ¶
ReadConfig function reads and parses config file
func StartDHCPClient ¶
func StartDHCPClient()
func StartGRPCServer ¶
func StartGRPCServer() error
func StringIPv4Int ¶
Types ¶
type Config ¶
type Config struct { HostName string `json:"host-name"` PortPairs []portPair `json:"port-pairs"` // contains filtered or unexported fields }
Config for NAT.
type DHCPv6FQDN ¶
type DHCPv6FQDN struct { Flags DHCPv6FQDNFlags DomainName string }
FQDN option encoded according to RFC 4704
func (*DHCPv6FQDN) DecodeFromBytes ¶
func (fqdn *DHCPv6FQDN) DecodeFromBytes(data []byte) error
func (*DHCPv6FQDN) Encode ¶
func (fqdn *DHCPv6FQDN) Encode() []byte
type DHCPv6FQDNFlags ¶
type DHCPv6FQDNFlags byte
const ( DHCPv6OptFQDNOptionCode layers.DHCPv6Opt = 39 DHCPv6FQDNOptionServerUpdateForwardDNS DHCPv6FQDNFlags = 1 DHCPv6FQDNOptionServerOverride DHCPv6FQDNFlags = 2 DHCPv6FQDNOptionServerNoDNSUpdate DHCPv6FQDNFlags = 4 )
type DHCPv6IAAddress ¶
type DHCPv6IAAddress struct { Address net.IP PreferredLifetime uint32 ValidLifetime uint32 Options layers.DHCPv6Options }
IA Address Option
func (*DHCPv6IAAddress) DecodeFromBytes ¶
func (ia *DHCPv6IAAddress) DecodeFromBytes(data []byte) error
func (*DHCPv6IAAddress) Encode ¶
func (ia *DHCPv6IAAddress) Encode() []byte
type DHCPv6IANA ¶
type DHCPv6IANA struct { IAID uint32 T1, T2 uint32 Options layers.DHCPv6Options }
Identity Association for Non-temporary Addresses Option
func (*DHCPv6IANA) DecodeFromBytes ¶
func (iana *DHCPv6IANA) DecodeFromBytes(data []byte) error
func (*DHCPv6IANA) Encode ¶
func (iana *DHCPv6IANA) Encode() []byte
type DHCPv6ServerStatusCode ¶
type DHCPv6ServerStatusCode struct { StatusCode layers.DHCPv6StatusCode StatusMessage string }
Server status code option
func (*DHCPv6ServerStatusCode) DecodeFromBytes ¶
func (sc *DHCPv6ServerStatusCode) DecodeFromBytes(data []byte) error
func (*DHCPv6ServerStatusCode) Encode ¶
func (sc *DHCPv6ServerStatusCode) Encode() []byte
Click to show internal directories.
Click to hide internal directories.