Version: v1.3.0 Latest Latest

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

Go to latest
Published: Sep 4, 2021 License: Apache-2.0 Imports: 5 Imported by: 0




This section is empty.


This section is empty.


func IsConnectionDying

func IsConnectionDying(conn *Connection) bool

func PolicyTypeToUint8

func PolicyTypeToUint8(policyType v1beta2.NetworkPolicyType) uint8

policyTypeToUint8 converts NetworkPolicy type to uint8

func RuleActionToUint8

func RuleActionToUint8(action string) uint8

RuleActionToUint8 converts network policy rule action to uint8.


type Connection

type Connection struct {
	// Fields from conntrack flows
	ID        uint32
	Timeout   uint32
	StartTime time.Time
	// For invalid and closed connections or deny connections: StopTime is the time when connection
	// was updated last.
	// For established connections: StopTime is latest time when it was polled.
	StopTime time.Time
	// IsPresent flag helps in cleaning up connections when they are not in conntrack table anymore.
	IsPresent bool
	// DyingAndDoneExport marks whether the related flow records are already exported or not so that we can
	// safely delete the connection from the connection map.
	DyingAndDoneExport bool
	Zone               uint16
	Mark               uint32
	StatusFlag         uint32
	Labels, LabelsMask []byte
	// TODO: Have a separate field for protocol. No need to keep it in Tuple.
	FlowKey                        Tuple
	OriginalPackets, OriginalBytes uint64
	ReversePackets, ReverseBytes   uint64
	// Fields specific to Antrea
	SourcePodNamespace             string
	SourcePodName                  string
	DestinationPodNamespace        string
	DestinationPodName             string
	DestinationServicePortName     string
	DestinationServiceAddress      net.IP
	DestinationServicePort         uint16
	IngressNetworkPolicyName       string
	IngressNetworkPolicyNamespace  string
	IngressNetworkPolicyType       uint8
	IngressNetworkPolicyRuleName   string
	IngressNetworkPolicyRuleAction uint8
	EgressNetworkPolicyName        string
	EgressNetworkPolicyNamespace   string
	EgressNetworkPolicyType        uint8
	EgressNetworkPolicyRuleName    string
	EgressNetworkPolicyRuleAction  uint8
	TCPState                       string
	// fields specific to deny connections
	// DeltaBytes and DeltaPackets are octetDeltaCount and packetDeltaCount over each active
	// flow timeout duration.
	DeltaBytes, DeltaPackets uint64
	LastExportTime           time.Time

type ConnectionKey

type ConnectionKey [5]string

func NewConnectionKey

func NewConnectionKey(conn *Connection) ConnectionKey

NewConnectionKey creates 5-tuple of flow as connection key

type ConnectionMapCallBack

type ConnectionMapCallBack func(key ConnectionKey, conn *Connection) error

type FlowRecord

type FlowRecord struct {
	Conn               Connection
	PrevPackets        uint64
	PrevBytes          uint64
	PrevReversePackets uint64
	PrevReverseBytes   uint64
	IsIPv6             bool
	LastExportTime     time.Time
	DyingAndDoneExport bool
	IsActive           bool

type FlowRecordCallBack

type FlowRecordCallBack func(key ConnectionKey, record FlowRecord) error

type Tuple

type Tuple struct {
	SourceAddress      net.IP
	DestinationAddress net.IP
	Protocol           uint8
	SourcePort         uint16
	DestinationPort    uint16

Source Files


Path Synopsis
Package testing is a generated GoMock package.
Package testing is a generated GoMock package.

Jump to

Keyboard shortcuts

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