Documentation ¶
Index ¶
- Constants
- type Key
- func (k Key) PortProtoIsBroader(c Key) bool
- func (k Key) String() string
- func (k Key) WithIdentity(nid identity.NumericIdentity) Key
- func (k Key) WithPort(port uint16) Key
- func (k Key) WithPortPrefix(port uint16, prefixLen uint8) Key
- func (k Key) WithPortProto(proto u8proto.U8proto, port uint16) Key
- func (k Key) WithPortProtoPrefix(proto u8proto.U8proto, port uint16, prefixLen uint8) Key
- func (k Key) WithProto(proto u8proto.U8proto) Key
- func (k Key) WithSCTPPort(port uint16) Key
- func (k Key) WithSCTPPortPrefix(port uint16, prefixLen uint8) Key
- func (k Key) WithTCPPort(port uint16) Key
- func (k Key) WithTCPPortPrefix(port uint16, prefixLen uint8) Key
- func (k Key) WithUDPPort(port uint16) Key
- func (k Key) WithUDPPortPrefix(port uint16, prefixLen uint8) Key
- type Keys
- type LPMKey
- func (k LPMKey) BitValueAt(i uint) uint8
- func (k LPMKey) CommonPrefix(b LPMKey) uint
- func (k LPMKey) EndPort() uint16
- func (k LPMKey) IsEgress() bool
- func (k LPMKey) IsIngress() bool
- func (k LPMKey) PortIsBroader(c Key) bool
- func (k LPMKey) PortIsEqual(c Key) bool
- func (k LPMKey) PortPrefixLen() uint8
- func (k LPMKey) PortProtoIsEqual(c Key) bool
- func (k LPMKey) PrefixLength() uint
- func (k LPMKey) TrafficDirection() trafficdirection.TrafficDirection
- func (k LPMKey) Value() LPMKey
Constants ¶
const MapStatePrefixLen = uint(32)
MapStatePrefixLen is the length, in bits, of the Key when converted to binary minus the sizeof the identity field (which is not indexed).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Key ¶
type Key struct { LPMKey // Identity is the numeric identity to / from which traffic is allowed. Identity identity.NumericIdentity }
func IngressKey ¶
func IngressKey() Key
func KeyForDirection ¶
func KeyForDirection(direction trafficdirection.TrafficDirection) Key
func (Key) PortProtoIsBroader ¶
PortProtoIsBroader returns true if the receiver Key has broader port-protocol than the argument Key. That is a port-protocol that covers the argument Key's port-protocol and is larger. An equal port-protocol will return false.
func (Key) WithIdentity ¶
func (k Key) WithIdentity(nid identity.NumericIdentity) Key
func (Key) WithPortProtoPrefix ¶
func (Key) WithSCTPPort ¶
func (Key) WithTCPPort ¶
func (Key) WithUDPPort ¶
type LPMKey ¶
type LPMKey struct { // NextHdr is the protocol which is allowed. Nexthdr u8proto.U8proto // DestPort is the port at L4 to / from which traffic is allowed, in // host-byte order. DestPort uint16 // contains filtered or unexported fields }
Key is the userspace representation of a policy key in BPF. It is intentionally duplicated from pkg/maps/policymap to avoid pulling in the BPF dependency to this package.
func (LPMKey) BitValueAt ¶
BitValueAt implements the BitValueAt method for the bitlpm.Key interface.
func (LPMKey) CommonPrefix ¶
CommonPrefix implements the CommonPrefix method for the bitlpm.Key interface. Identity is not indexed and is instead, saved as a simple map per TrafficDirection-Protocol-Port index key.
func (LPMKey) PortIsBroader ¶
PortIsBroader returns true if the receiver Key's port range covers the argument Key's port range, but returns false if they are equal.
func (LPMKey) PortIsEqual ¶
PortIsEqual returns true if the port ranges between the two keys are exactly equal.
func (LPMKey) PortPrefixLen ¶
PortPrefixLen returns the length of the bitwise mask that should be applied to the DestPort.
func (LPMKey) PortProtoIsEqual ¶
PortProtoIsEqual returns true if the port-protocols of the two keys are exactly equal.
func (LPMKey) PrefixLength ¶
PrefixLength returns the prefix lenth of the key for indexing it for the userspace cache (not the BPF map or datapath).
func (LPMKey) TrafficDirection ¶
func (k LPMKey) TrafficDirection() trafficdirection.TrafficDirection
TrafficDirection() returns the direction of the Key, 0 == ingress, 1 == egress