Documentation ¶
Overview ¶
Package vppcalls contains wrappers over VPP binary APIs for NAT configuration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddNatHandlerVersion ¶
Types ¶
type Nat44InitOpts ¶ added in v3.3.0
type Nat44InitOpts struct { // Endpoint dependent mode uses 6-tuple: (source IP address, source port, target IP address, // target port, protocol, FIB table index) as session hash table key, whereas // in the endpoint independent mode only 4-tuple (source IP address, source port, protocol, FIB table index) // is used. EndpointDependent bool // Track connection (e.g. TCP states, timeout). // In the dynamic mode the connection tracking is essential and performed by default. // With StaticMappingOnly=true it is disabled and has to be turned on explicitly if needed. ConnectionTracking bool // If enabled only static translations are performed (i.e. no dynamic session entries). StaticMappingOnly bool // Policy-based packet processing and address translation. // Not supported in the endpoint-dependent mode. OutToInDPO bool }
Previously these options were configured for NAT44 plugin via the startup configuration file. As of VPP 21.01 it is possible to configure/change them in run-time (by disabling and then re-enabling the plugin with changed options). These are just some of the supported options. For full list of what VPP allows to configure, see nat44_plugin_enable_disable binary API.
type NatVppAPI ¶
type NatVppAPI interface { NatVppRead // Enable NAT44 plugin and apply the given set of options. EnableNAT44Plugin(opts Nat44InitOpts) error // DisableNAT44Plugin disables NAT44 plugin. DisableNAT44Plugin() error // SetNat44Forwarding configures NAT44 forwarding. SetNat44Forwarding(enableFwd bool) error // EnableNat44Interface enables NAT44 feature for provided interface EnableNat44Interface(iface string, isInside, isOutput bool) error // DisableNat44Interface disables NAT feature for provided interface DisableNat44Interface(iface string, isInside, isOutput bool) error // AddNat44AddressPool adds new IPV4 address pool into the NAT pools. AddNat44AddressPool(vrf uint32, firstIP, lastIP string, twiceNat bool) error // DelNat44AddressPool removes existing IPv4 address pool from the NAT pools. DelNat44AddressPool(vrf uint32, firstIP, lastIP string, twiceNat bool) error // SetVirtualReassemblyIPv4 configures NAT virtual reassembly for IPv4 packets. SetVirtualReassemblyIPv4(vrCfg *nat.VirtualReassembly) error // SetVirtualReassemblyIPv6 configures NAT virtual reassembly for IPv6 packets. SetVirtualReassemblyIPv6(vrCfg *nat.VirtualReassembly) error // AddNat44IdentityMapping adds new NAT44 identity mapping AddNat44IdentityMapping(mapping *nat.DNat44_IdentityMapping, dnatLabel string) error // DelNat44IdentityMapping removes NAT44 identity mapping DelNat44IdentityMapping(mapping *nat.DNat44_IdentityMapping, dnatLabel string) error // AddNat44StaticMapping creates new NAT44 static mapping entry. AddNat44StaticMapping(mapping *nat.DNat44_StaticMapping, dnatLabel string) error // DelNat44StaticMapping removes existing NAT44 static mapping entry. DelNat44StaticMapping(mapping *nat.DNat44_StaticMapping, dnatLabel string) error }
NatVppAPI provides methods for managing VPP NAT configuration.
func CompatibleNatVppHandler ¶
func CompatibleNatVppHandler(c vpp.Client, ifIdx ifaceidx.IfaceMetadataIndex, dhcpIdx idxmap.NamedMapping, log logging.Logger) NatVppAPI
type NatVppRead ¶
type NatVppRead interface { // WithLegacyStartupConf returns true if the loaded VPP NAT plugin is still using // the legacy startup NAT configuration (this is the case for VPP <= 20.09). WithLegacyStartupConf() bool // DefaultNat44GlobalConfig returns default global configuration. DefaultNat44GlobalConfig() *nat.Nat44Global // Nat44GlobalConfigDump dumps global NAT44 config in NB format. // If dumpDeprecated is true, dumps deprecated NAT44 global config as well. Nat44GlobalConfigDump(dumpDeprecated bool) (*nat.Nat44Global, error) // DNat44Dump dumps all configured DNAT-44 configurations ordered by label. DNat44Dump() ([]*nat.DNat44, error) // Nat44InterfacesDump dumps NAT44 config of all NAT44-enabled interfaces. Nat44InterfacesDump() ([]*nat.Nat44Interface, error) // Nat44AddressPoolsDump dumps all configured NAT44 address pools. Nat44AddressPoolsDump() ([]*nat.Nat44AddressPool, error) }
NatVppRead provides read methods for VPP NAT configuration.
Click to show internal directories.
Click to hide internal directories.