types

package
v3.29.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Family type definitions
	FAMILY_ALL = unix.AF_UNSPEC
	FAMILY_V4  = unix.AF_INET
	FAMILY_V6  = unix.AF_INET6
)
View Source
const (
	CnatNoNat = uint8(cnat.CNAT_EPT_NO_NAT)
)
View Source
const InvalidID uint32 = ^uint32(0)
View Source
const (
	InvalidInterface = interface_types.InterfaceIndex(^uint32(0))
)
View Source
const InvalidTableId = ^uint32(0)
View Source
const (
	VectorSize = 16
)

Variables

View Source
var (
	FiveTupleMask     []byte
	DstFourTupleMask  []byte
	DstThreeTupleMask []byte
	SrcThreeTupleMask []byte
	DstAddrMask       []byte
	SrcAddrMask       []byte
)
View Source
var (
	VppErrorUnimplemented = api.UNIMPLEMENTED
)

Functions

func AddrIsZeros

func AddrIsZeros(p net.IP) bool

func FormatRxMode

func FormatRxMode(rxMode RxMode) string

func FromVppAddress

func FromVppAddress(addr ip_types.Address) net.IP

func FromVppAddressWithPrefix

func FromVppAddressWithPrefix(prefix ip_types.AddressWithPrefix) *net.IPNet

func FromVppIpAddressUnion

func FromVppIpAddressUnion(Un ip_types.AddressUnion, isv6 bool) net.IP

func FromVppPrefix

func FromVppPrefix(prefix ip_types.Prefix) *net.IPNet

func GetBoolIPFamily

func GetBoolIPFamily(isIP6 bool) ip_types.AddressFamily

func GetIPFamily

func GetIPFamily(ip net.IP) int

func GetPciIdInt

func GetPciIdInt(PciIdStr string) (id uint32, err error)

func IPToAddr added in v3.27.0

func IPToAddr(a net.IP) netip.Addr

func IntListToString

func IntListToString(prefix string, lst []uint32) string

func IsIP4

func IsIP4(ip net.IP) bool

func IsIP6

func IsIP6(ip net.IP) bool

func IsV6toFibProto

func IsV6toFibProto(isv6 bool) fib_types.FibPathNhProto

func MacAddress added in v3.26.0

func MacAddress(hwAddr net.HardwareAddr) ethernet_types.MacAddress

func StrListToString

func StrListToString(prefix string, lst []string) string

func StrableListToString

func StrableListToString(prefix string, arg interface{}) string

func ToCapoPolicy

func ToCapoPolicy(p *Policy) (items []capo.CapoPolicyItem)

func ToCapoRule

func ToCapoRule(r *Rule) (cr capo.CapoRule)

func ToCnatEndpoint

func ToCnatEndpoint(ep CnatEndpoint) cnat.CnatEndpoint

func ToFibPathList

func ToFibPathList(routePaths []RoutePath, isIP6 bool) (apiPathList []fib_types.FibPath)

func ToVppAddress

func ToVppAddress(addr net.IP) ip_types.Address

func ToVppAddressFamily

func ToVppAddressFamily(isv6 bool) ip_types.AddressFamily

func ToVppAddressWithPrefix

func ToVppAddressWithPrefix(prefix *net.IPNet) ip_types.AddressWithPrefix

func ToVppIP4Address

func ToVppIP4Address(addr net.IP) ip_types.IP4Address

Make sure you really call this with an IPv4 address...

func ToVppIP6Address

func ToVppIP6Address(addr net.IP) ip_types.IP6Address

func ToVppIPProto

func ToVppIPProto(proto IPProto) ip_types.IPProto

func ToVppNatConfigFlags

func ToVppNatConfigFlags(flags NatFlags) nat_types.NatConfigFlags

func ToVppNeighborFlags

func ToVppNeighborFlags(flags IPNeighborFlags) ip_neighbor.IPNeighborFlags

func ToVppPrefix

func ToVppPrefix(prefix *net.IPNet) ip_types.Prefix

func ToVppSrBehavior

func ToVppSrBehavior(behavior SrBehavior) sr_types.SrBehavior

func ToVppSrSteerTrafficType

func ToVppSrSteerTrafficType(trafficType SrSteerTrafficType) sr_types.SrSteer

Types

type ACL

type ACL struct {
	ACLIndex uint32
	Tag      string
	Rules    []ACLRule
}

type ACLRule

type ACLRule struct {
	Src     net.IPNet
	Dst     net.IPNet
	SrcPort uint16
	DstPort uint16
	Proto   IPProto
}

func (*ACLRule) ToVppACLRule

func (r *ACLRule) ToVppACLRule() acl_types.ACLRule

type AVFInterface

type AVFInterface struct {
	GenericVppInterface
	PciId string
}

type AbfPolicy

type AbfPolicy struct {
	Paths    []RoutePath
	PolicyID uint32
	AclIndex uint32
}

type AfPacketInterface

type AfPacketInterface struct {
	GenericVppInterface
	Flags af_packet.AfPacketFlags
}

type ClassifyAction added in v3.27.0

type ClassifyAction int
const (
	AddAbsolute ClassifyAction = iota
	AddRelative
	Del
	DelChain
)

type ClassifyTable added in v3.27.0

type ClassifyTable struct {
	TableIndex        uint32
	NBuckets          uint32
	MaxNumEntries     uint32
	MatchNVectors     uint32
	SkipNVectors      uint32
	NextTableIndex    uint32
	MissNextIndex     uint32
	Mask              []byte
	MemorySize        uint32
	CurrentDataOffset int16
}

type CnatEndpoint

type CnatEndpoint struct {
	IP   net.IP
	Port uint16
}

func (*CnatEndpoint) String

func (e *CnatEndpoint) String() string

type CnatEndpointTuple

type CnatEndpointTuple struct {
	SrcEndpoint CnatEndpoint
	DstEndpoint CnatEndpoint
	Flags       uint8
}

func (*CnatEndpointTuple) String

func (t *CnatEndpointTuple) String() string

type CnatLbType

type CnatLbType uint8

type CnatTranslateEntry

type CnatTranslateEntry struct {
	Endpoint   CnatEndpoint
	Backends   []CnatEndpointTuple
	Proto      IPProto
	IsRealIP   bool
	LbType     CnatLbType
	HashConfig IPFlowHash
}

func (*CnatTranslateEntry) Equal

func (*CnatTranslateEntry) Key

func (e *CnatTranslateEntry) Key() string

func (*CnatTranslateEntry) String

func (n *CnatTranslateEntry) String() string

type DstThreeTuple added in v3.27.0

type DstThreeTuple struct {
	Protocol IPProto
	DstAddr  netip.Addr
	DstPort  uint16
}

type FiveTuple added in v3.27.0

type FiveTuple struct {
	Protocol IPProto
	SrcAddr  netip.Addr
	SrcPort  uint16
	DstAddr  netip.Addr
	DstPort  uint16
}

func New5Tuple added in v3.27.0

func New5Tuple(protocol IPProto, srcAddr net.IP, srcPort uint16, dstAddr net.IP, dstPort uint16) FiveTuple

func NewDst3Tuple added in v3.27.0

func NewDst3Tuple(protocol IPProto, dstAddr net.IP, dstPort uint16) FiveTuple

func NewDst4Tuple added in v3.27.0

func NewDst4Tuple(protocol IPProto, srcAddr net.IP, dstAddr net.IP, dstPort uint16) FiveTuple

func NewSrc3Tuple added in v3.27.0

func NewSrc3Tuple(protocol IPProto, srcAddr net.IP, srcPort uint16) FiveTuple

func (*FiveTuple) GetBPF added in v3.27.0

func (tuple *FiveTuple) GetBPF() string

func (*FiveTuple) GetMask added in v3.27.0

func (tuple *FiveTuple) GetMask() ([]byte, error)

func (*FiveTuple) GetMatch added in v3.27.0

func (tuple *FiveTuple) GetMatch() ([]byte, error)

func (*FiveTuple) String added in v3.27.0

func (tuple *FiveTuple) String() string

type GenericVppInterface

type GenericVppInterface struct {
	Name              string /* Desired name in VPP */
	HostInterfaceName string /* Name of the host interface */
	HardwareAddr      net.HardwareAddr
	NumRxQueues       int
	NumTxQueues       int
	TxQueueSize       int
	RxQueueSize       int
	/* return value on create */
	SwIfIndex uint32
}

type GeneveHeader added in v3.27.0

type GeneveHeader struct {
	VersionOptLen uint8
	Flags         uint8
	ProtocolType  uint16
	Vni           uint32
	Options       []byte
}

func (GeneveHeader) FixedBytes added in v3.27.0

func (h GeneveHeader) FixedBytes() []byte

type GeneveV4Header added in v3.27.0

type GeneveV4Header struct {
	UDPv4Header
	GeneveHeader
}

func NewGeneveHeader added in v3.27.0

func NewGeneveHeader(outerFiveTuple FiveTuple, vni uint32) GeneveV4Header

func (GeneveV4Header) Bytes added in v3.27.0

func (h GeneveV4Header) Bytes() ([]byte, error)

func (*GeneveV4Header) GetMask added in v3.27.0

func (gnv *GeneveV4Header) GetMask() ([]byte, error)

func (*GeneveV4Header) GetMatch added in v3.27.0

func (gnv *GeneveV4Header) GetMatch() ([]byte, error)

type IPPort

type IPPort struct {
	Addr    net.IP
	L4Proto uint8
	Port    uint16
}

func (*IPPort) Equal

func (i *IPPort) Equal(j *IPPort) bool

type IPProto

type IPProto uint8

func UnformatProto

func UnformatProto(proto string) (IPProto, error)

func (IPProto) String

func (proto IPProto) String() string

func (*IPProto) UnmarshalText added in v3.27.0

func (mode *IPProto) UnmarshalText(text []byte) error

type IPsecTunnelProtection

type IPsecTunnelProtection struct {
	SwIfIndex   uint32
	NextHop     net.IP
	OutSAIndex  uint32
	InSAIndices []uint32
}

type IPv4Header added in v3.27.0

type IPv4Header struct {
	VersionIHL uint8
	Tos        uint8
	TotLen     uint16
	Id         uint16
	FragOff    uint16
	Ttl        uint8
	Protocol   uint8
	Csum       uint16
	Saddr      [4]byte
	Daddr      [4]byte
}

type IfAddress

type IfAddress struct {
	IPNet     net.IPNet
	SwIfIndex uint32
}

type InterfaceConfig

type InterfaceConfig struct {
	IngressPolicyIDs []uint32
	EgressPolicyIDs  []uint32
	ProfileIDs       []uint32
}

func NewInterfaceConfig

func NewInterfaceConfig() *InterfaceConfig

type InterfaceEvent added in v3.25.1

type InterfaceEvent struct {
	SwIfIndex uint32
	Type      InterfaceEventType
}

func ToInterfaceEvent added in v3.25.1

func ToInterfaceEvent(e *interfaces.SwInterfaceEvent) InterfaceEvent

type InterfaceEventType added in v3.25.1

type InterfaceEventType int
const (
	InterfaceEventUnknown InterfaceEventType = iota
	InterfaceEventAdminUp
	InterfaceEventLinkUp
	InterfaceEventDeleted
)

type IpPuntRedirect

type IpPuntRedirect struct {
	RxSwIfIndex uint32
	IsIP6       bool
	Paths       []RoutePath
}

type IpsetType

type IpsetType uint8
const (
	IpsetTypeIP     IpsetType = IpsetType(capo.CAPO_IP)
	IpsetTypeIPPort IpsetType = IpsetType(capo.CAPO_IP_AND_PORT)
	IpsetTypeNet    IpsetType = IpsetType(capo.CAPO_NET)
)

func (IpsetType) String

func (i IpsetType) String() string

type Memif

type Memif struct {
	Role        MemifRole
	Mode        MemifMode
	NumRxQueues int
	NumTxQueues int
	QueueSize   int
	MacAddress  net.HardwareAddr
	SocketId    uint32
	SwIfIndex   uint32
	Flags       MemifFlag
}

type MemifFlag

type MemifFlag uint32

type MemifMode

type MemifMode uint32

type MemifRole

type MemifRole uint32

type MemifSocket

type MemifSocket struct {
	SocketID       uint32
	SocketFilename string
}

type Nat44Entry

type Nat44Entry struct {
	ServiceIP   net.IP
	ServicePort int32
	Protocol    IPProto
	BackendIPs  []net.IP
	BackendPort int32
}

func (*Nat44Entry) String

func (n *Nat44Entry) String() string

type Neighbor

type Neighbor struct {
	SwIfIndex    uint32
	IP           net.IP
	HardwareAddr net.HardwareAddr
	Flags        IPNeighborFlags
}

type ObjEqualityState

type ObjEqualityState int
const (
	AreEqualObj       ObjEqualityState = iota /* objects are equal */
	CanUpdateObj                              /* objects differ, but you can call update */
	ShouldRecreateObj                         /* object differ, you need to delete the old & add back the new */
)

type PblClient

type PblClient struct {
	ID         uint32
	TableId    uint32
	Addr       net.IP
	Path       RoutePath
	PortRanges []PblPortRange
}

type PblPortRange

type PblPortRange struct {
	Start uint16
	End   uint16
	Proto IPProto
}

type Policy

type Policy struct {
	InboundRuleIDs  []uint32
	OutboundRuleIDs []uint32
}

func (*Policy) DeepCopy

func (p *Policy) DeepCopy() *Policy

func (*Policy) String

func (p *Policy) String() string

type PortRange

type PortRange struct {
	First uint16
	Last  uint16
}

func (PortRange) String

func (pr PortRange) String() string

type RDMAInterface

type RDMAInterface struct {
	GenericVppInterface
}

type Route

type Route struct {
	Dst   *net.IPNet
	Paths []RoutePath
	Table uint32
	RpfID uint32
}

func (*Route) IsIP6

func (r *Route) IsIP6() bool

func (*Route) IsLinkLocal

func (r *Route) IsLinkLocal() bool

func (*Route) String

func (r *Route) String() string

type RoutePath

type RoutePath struct {
	Gw         net.IP
	SwIfIndex  uint32
	Table      uint32
	IsAttached bool
	Preference uint8
	RpfID      uint32
}

func FromFibPath

func FromFibPath(vppPath fib_types.FibPath) RoutePath

func FromFibPathList

func FromFibPathList(apiPathList []fib_types.FibPath) (routePaths []RoutePath)

func (*RoutePath) String

func (p *RoutePath) String() string

func (*RoutePath) ToFibPath

func (p *RoutePath) ToFibPath(isIP6 bool) fib_types.FibPath

type Rule

type Rule struct {
	Action        RuleAction
	AddressFamily int
	Filters       []RuleFilter

	DstNet    []net.IPNet
	DstNotNet []net.IPNet
	SrcNet    []net.IPNet
	SrcNotNet []net.IPNet

	DstPortRange    []PortRange
	DstNotPortRange []PortRange
	SrcPortRange    []PortRange
	SrcNotPortRange []PortRange

	DstIPPortIPSet    []uint32
	DstNotIPPortIPSet []uint32
	SrcIPPortIPSet    []uint32
	SrcNotIPPortIPSet []uint32

	DstIPSet    []uint32
	DstNotIPSet []uint32
	SrcIPSet    []uint32
	SrcNotIPSet []uint32

	DstIPPortSet []uint32
}

func (*Rule) DeepCopy

func (r *Rule) DeepCopy() *Rule

func (*Rule) String

func (r *Rule) String() string

type RuleAction

type RuleAction uint8

func (RuleAction) String

func (r RuleAction) String() string

type RuleFilter

type RuleFilter struct {
	ShouldMatch bool
	Type        CapoFilterType
	Value       int
}

func (RuleFilter) String

func (f RuleFilter) String() string

type RxMode

type RxMode uint32
const (
	UnknownRxMode    RxMode = 0
	PollingRxMode    RxMode = 1
	InterruptRxMode  RxMode = 2
	AdaptativeRxMode RxMode = 3
	DefaultRxMode    RxMode = 4

	AllQueues = ^uint32(0)
)

func (*RxMode) UnmarshalText added in v3.25.1

func (mode *RxMode) UnmarshalText(text []byte) error

type SessionAppNamespace

type SessionAppNamespace struct {
	NamespaceId string
	Netns       string
	SwIfIndex   uint32
	SocketName  string
	Secret      uint64
}

type SessionRedirect added in v3.27.0

type SessionRedirect struct {
	FiveTuple
	TableIndex  uint32
	IsPunt      bool
	OpaqueIndex uint32
}

func (*SessionRedirect) String added in v3.27.0

func (sr *SessionRedirect) String() string

func (*SessionRedirect) VppString added in v3.27.0

func (sr *SessionRedirect) VppString() string

type SrLocalsid

type SrLocalsid struct {
	Localsid  ip_types.IP6Address
	EndPsp    bool
	Behavior  SrBehavior
	SwIfIndex interface_types.InterfaceIndex
	VlanIndex uint32
	FibTable  uint32
	NhAddr    ip_types.Address
}

SrLocalsid definition

func (*SrLocalsid) CompareBehaviorTo

func (l *SrLocalsid) CompareBehaviorTo(behavior uint8) bool

func (*SrLocalsid) SetBehavior

func (l *SrLocalsid) SetBehavior(code uint8)

func (*SrLocalsid) String

func (l *SrLocalsid) String() (policy string)

type SrPolicy

type SrPolicy struct {
	Bsid     ip_types.IP6Address
	IsSpray  bool
	IsEncap  bool
	FibTable uint32
	SidLists []Srv6SidList
}

SrPolicy definition

func (*SrPolicy) FromVPP

func (p *SrPolicy) FromVPP(response *sr.SrPoliciesDetails)

func (*SrPolicy) String

func (p *SrPolicy) String() (policy string)

type SrSteer

type SrSteer struct {
	TrafficType SrSteerTrafficType
	FibTable    uint32
	Prefix      ip_types.Prefix
	SwIfIndex   uint32
	Bsid        ip_types.IP6Address
}

func (*SrSteer) String

func (s *SrSteer) String() string

type Srv6SidList

type Srv6SidList struct {
	NumSids uint8
	Weight  uint32
	Sids    [16]ip_types.IP6Address
}

Srv6SidList definition

func (*Srv6SidList) String

func (s *Srv6SidList) String() string

type TCPPorts added in v3.27.0

type TCPPorts struct {
	Sport uint16
	Dport uint16
}

type TCPv4Header added in v3.27.0

type TCPv4Header struct {
	IP  IPv4Header
	TCP TCPPorts
}

func (TCPv4Header) Bytes added in v3.27.0

func (h TCPv4Header) Bytes() ([]byte, error)

type TapFlags

type TapFlags uint32
const (
	TapFlagNone        TapFlags = 0
	TapFlagGSO         TapFlags = 1
	TapFlagCsumOffload TapFlags = 2
	TapFlagPersist     TapFlags = 4
	TapFlagAttach      TapFlags = 8
	TapFlagTun         TapFlags = 16
	TapGROCoalesce     TapFlags = 32
)

type TapV2

type TapV2 struct {
	GenericVppInterface
	HostNamespace  string
	Tag            string
	HostMacAddress net.HardwareAddr
	Flags          TapFlags
	HostMtu        int
}

type UDPHeader added in v3.27.0

type UDPHeader struct {
	Sport uint16
	Dport uint16
	Len   uint16
	Csum  uint16
}

type UDPv4Header added in v3.27.0

type UDPv4Header struct {
	IP  IPv4Header
	UDP UDPHeader
}

func NewUDPv4Header added in v3.27.0

func NewUDPv4Header(buffer []byte) (*UDPv4Header, error)

func (UDPv4Header) Bytes added in v3.27.0

func (h UDPv4Header) Bytes() ([]byte, error)

type VRF

type VRF struct {
	Name  string
	VrfID uint32
	IsIP6 bool
}

type VXLanTunnel

type VXLanTunnel struct {
	SrcAddress     net.IP
	DstAddress     net.IP
	SrcPort        uint16
	DstPort        uint16
	Vni            uint32
	DecapNextIndex uint32
	SwIfIndex      uint32
}

func (*VXLanTunnel) String

func (t *VXLanTunnel) String() string

type VirtioInterface

type VirtioInterface struct {
	GenericVppInterface
	PciId string
}

type Vmxnet3Interface

type Vmxnet3Interface struct {
	GenericVppInterface
	PciId     string
	EnableGso bool
}

type VppInterfaceDetails

type VppInterfaceDetails struct {
	SwIfIndex uint32
	IsUp      bool
	Name      string
	Tag       string
	Type      string
	Mtu       []uint32
}

type VppXDPInterface

type VppXDPInterface struct {
	GenericVppInterface
}

type WireguardPeer

type WireguardPeer struct {
	PublicKey           []byte
	Port                uint16
	PersistentKeepalive int
	TableID             uint32
	Addr                net.IP
	SwIfIndex           uint32
	Index               uint32
	AllowedIps          []net.IPNet
}

func (*WireguardPeer) AddAllowedIp

func (t *WireguardPeer) AddAllowedIp(addr net.IPNet)

func (*WireguardPeer) DelAllowedIp

func (t *WireguardPeer) DelAllowedIp(addr net.IPNet)

func (*WireguardPeer) Equal

func (t *WireguardPeer) Equal(o *WireguardPeer) bool

func (*WireguardPeer) String

func (t *WireguardPeer) String() string

type WireguardTunnel

type WireguardTunnel struct {
	Addr       net.IP
	Port       uint16
	SwIfIndex  uint32
	PublicKey  []byte
	PrivateKey []byte
}

func (*WireguardTunnel) String

func (t *WireguardTunnel) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL