Documentation ¶
Overview ¶
Package vppcalls contains wrappers over VPP binary APIs for NAT configuration.
Index ¶
- Constants
- type NatVppAPI
- type NatVppHandler
- func (h *NatVppHandler) AddNat44Address(address string, vrf uint32, twiceNat bool) error
- func (h *NatVppHandler) AddNat44IdentityMapping(mapping *nat.DNat44_IdentityMapping, dnatLabel string) error
- func (h *NatVppHandler) AddNat44StaticMapping(mapping *nat.DNat44_StaticMapping, dnatLabel string) error
- func (h *NatVppHandler) DNat44Dump() (dnats []*nat.DNat44, err error)
- func (h *NatVppHandler) DelNat44Address(address string, vrf uint32, twiceNat bool) error
- func (h *NatVppHandler) DelNat44IdentityMapping(mapping *nat.DNat44_IdentityMapping, dnatLabel string) error
- func (h *NatVppHandler) DelNat44StaticMapping(mapping *nat.DNat44_StaticMapping, dnatLabel string) error
- func (h *NatVppHandler) DisableNat44Interface(iface string, isInside, isOutput bool) error
- func (h *NatVppHandler) EnableNat44Interface(iface string, isInside, isOutput bool) error
- func (h *NatVppHandler) Nat44GlobalConfigDump() (*nat.Nat44Global, error)
- func (h *NatVppHandler) SetNat44Forwarding(enableFwd bool) error
- func (h *NatVppHandler) SetVirtualReassemblyIPv4(vrCfg *nat.VirtualReassembly) error
- func (h *NatVppHandler) SetVirtualReassemblyIPv6(vrCfg *nat.VirtualReassembly) error
- type NatVppRead
- type NatVppWrite
Constants ¶
const ( ICMP uint8 = 1 TCP uint8 = 6 UDP uint8 = 17 )
Num protocol representation
const ( // NoInterface is sw-if-idx which means 'no interface' NoInterface = ^uint32(0) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NatVppAPI ¶
type NatVppAPI interface { NatVppWrite NatVppRead }
NatVppAPI provides methods for managing VPP NAT configuration.
type NatVppHandler ¶
type NatVppHandler struct {
// contains filtered or unexported fields
}
NatVppHandler is accessor for NAT-related vppcalls methods.
func NewNatVppHandler ¶
func NewNatVppHandler(callsChan api.Channel, ifIndexes ifaceidx.IfaceMetadataIndex, dhcpIndex idxmap.NamedMapping, log logging.Logger) *NatVppHandler
NewNatVppHandler creates new instance of NAT vppcalls handler.
func (*NatVppHandler) AddNat44Address ¶
func (h *NatVppHandler) AddNat44Address(address string, vrf uint32, twiceNat bool) error
AddNat44Address adds new IPv4 address into the NAT44 pool.
func (*NatVppHandler) AddNat44IdentityMapping ¶
func (h *NatVppHandler) AddNat44IdentityMapping(mapping *nat.DNat44_IdentityMapping, dnatLabel string) error
AddNat44IdentityMapping adds new NAT44 identity mapping
func (*NatVppHandler) AddNat44StaticMapping ¶
func (h *NatVppHandler) AddNat44StaticMapping(mapping *nat.DNat44_StaticMapping, dnatLabel string) error
AddNat44StaticMapping creates new NAT44 static mapping entry.
func (*NatVppHandler) DNat44Dump ¶
func (h *NatVppHandler) DNat44Dump() (dnats []*nat.DNat44, err error)
DNat44Dump dumps all configured DNAT-44 configurations ordered by label.
func (*NatVppHandler) DelNat44Address ¶
func (h *NatVppHandler) DelNat44Address(address string, vrf uint32, twiceNat bool) error
DelNat44Address removes existing IPv4 address from the NAT44 pool.
func (*NatVppHandler) DelNat44IdentityMapping ¶
func (h *NatVppHandler) DelNat44IdentityMapping(mapping *nat.DNat44_IdentityMapping, dnatLabel string) error
DelNat44IdentityMapping removes existing NAT44 identity mapping
func (*NatVppHandler) DelNat44StaticMapping ¶
func (h *NatVppHandler) DelNat44StaticMapping(mapping *nat.DNat44_StaticMapping, dnatLabel string) error
DelNat44StaticMapping removes existing NAT44 static mapping entry.
func (*NatVppHandler) DisableNat44Interface ¶
func (h *NatVppHandler) DisableNat44Interface(iface string, isInside, isOutput bool) error
DisableNat44Interface disables NAT44 feature for provided interface.
func (*NatVppHandler) EnableNat44Interface ¶
func (h *NatVppHandler) EnableNat44Interface(iface string, isInside, isOutput bool) error
EnableNat44Interface enables NAT44 feature for provided interface.
func (*NatVppHandler) Nat44GlobalConfigDump ¶
func (h *NatVppHandler) Nat44GlobalConfigDump() (*nat.Nat44Global, error)
Nat44GlobalConfigDump dumps global NAT44 config in NB format.
func (*NatVppHandler) SetNat44Forwarding ¶
func (h *NatVppHandler) SetNat44Forwarding(enableFwd bool) error
SetNat44Forwarding configures NAT44 forwarding.
func (*NatVppHandler) SetVirtualReassemblyIPv4 ¶
func (h *NatVppHandler) SetVirtualReassemblyIPv4(vrCfg *nat.VirtualReassembly) error
SetVirtualReassemblyIPv4 configures NAT virtual reassembly for IPv4 packets.
func (*NatVppHandler) SetVirtualReassemblyIPv6 ¶
func (h *NatVppHandler) SetVirtualReassemblyIPv6(vrCfg *nat.VirtualReassembly) error
SetVirtualReassemblyIPv6 configures NAT virtual reassembly for IPv6 packets.
type NatVppRead ¶
type NatVppRead interface { // Nat44GlobalConfigDump dumps global NAT44 config in NB format. Nat44GlobalConfigDump() (*nat.Nat44Global, error) // DNat44Dump dumps all configured DNAT-44 configurations ordered by label. DNat44Dump() ([]*nat.DNat44, error) }
NatVppRead provides read methods for VPP NAT configuration.
type NatVppWrite ¶
type NatVppWrite interface { // 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 // AddNat44Address adds new IPV4 address into the NAT pool. AddNat44Address(address string, vrf uint32, twiceNat bool) error // DelNat44Address removes existing IPv4 address from the NAT pool. DelNat44Address(address string, vrf uint32, 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 }
NatVppWrite provides write methods for VPP NAT configuration.