flow

package module
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthType added in v0.6.0

func AuthType() flowpb.AuthType

AuthType generates a random AuthType.

func DropReason

func DropReason(options ...DropReasonOption) flowpb.DropReason

DropReason generates a DropReason. Options may be provided to customize the drop reasons to return.

func Endpoint

func Endpoint(options ...EndpointOption) *flowpb.Endpoint

Endpoint generates a random Endpoint. Options may be provided to customize the endpoint to return.

func EventType

func EventType() *flowpb.CiliumEventType

EventType generates a random EventType.

func ICMPv4

func ICMPv4() *flowpb.ICMPv4

ICMPv4 generates a random ICMPv4 flow.

func ICMPv6

func ICMPv6() *flowpb.ICMPv6

ICMPv6 generates a random ICMPv6 flow.

func IsReply

func IsReply() *wrapperspb.BoolValue

IsReply returns either nil, or a wrapped boolean value reprenting true, or a wrapped boolean value reprenting false, with equal probability.

func Layer4

func Layer4(options ...Layer4Option) *flowpb.Layer4

Layer4 generates a layer 4. If no option is provided, it will be TCP.

func New

func New(options ...Option) *flowpb.Flow

New generates a random flow. Options may be provided to customize the flow.

func Service

func Service(options ...ServiceOption) *flowpb.Service

Service generates a random Service. Options may be provided to customize the service to return.

func TraceContext added in v0.3.0

func TraceContext(options ...TraceContextOption) *flowpb.TraceContext

TraceContext generates a TraceContext. Options may be provided to customize the returned object.

func TraceObservationPoint

func TraceObservationPoint() flowpb.TraceObservationPoint

TraceObservationPoint generates a random TraceObservationPoint.

func TrafficDirection

func TrafficDirection() flowpb.TrafficDirection

TrafficDirection generates a random TrafficDirection.

func Verdict

func Verdict(options ...VerdictOption) flowpb.Verdict

Verdict generates a FORWARDED or DROPPPED verdict randomly. The probability of the verdict being FORWARDED can be set using WithVerdictForwardedProbability.

Types

type DropReasonOption

type DropReasonOption interface {
	// contains filtered or unexported methods
}

DropReasonOption is an option to use with DropReason.

func WithDropReasonNonDropProbability

func WithDropReasonNonDropProbability(probability float64) DropReasonOption

WithDropReasonNonDropProbability sets the probability of returning a non-drop drop reason (defaults to 0.999). The value must be between 0 and 1.

func WithDropReasonSubSet

func WithDropReasonSubSet(dropReasons []flowpb.DropReason) DropReasonOption

WithDropReasonSubSet defines a set of DropReason to be returned. Note that this does not affect non-drop events. If non-drop events are not desired, use WithDropReasonNonDropProbability(0.0).

type EndpointOption

type EndpointOption interface {
	// contains filtered or unexported methods
}

EndpointOption is an option to use with Endpoint.

func WithEndpointLabels

func WithEndpointLabels(labels []string) EndpointOption

WithEndpointLabels sets the labels of the endpoint.

func WithEndpointNamespace

func WithEndpointNamespace(ns string) EndpointOption

WithEndpointNamespace sets the namespace of the endpoint.

func WithEndpointPodName

func WithEndpointPodName(name string) EndpointOption

WithEndpointPodName sets the pod name of the endpoint.

func WithEndpointWorkloads added in v0.2.0

func WithEndpointWorkloads(workloads map[string]string) EndpointOption

WithEndpointWorkloads sets the endpoint workloads. The map's keys are the workload names, and values are the workload kind.

type Layer4Option

type Layer4Option interface {
	// contains filtered or unexported methods
}

Layer4Option is an option to use with Layer4.

func WithLayer4DestinationPort added in v0.4.0

func WithLayer4DestinationPort(port uint32) Layer4Option

WithLayer4DestinationPort specifies the destination port for UDP, TCP, and SCTP. Only useful in conjunction with either WithLayer4UDP, WithLayer4TCP, or WithLayer4SCTP.

func WithLayer4ICMPv4

func WithLayer4ICMPv4() Layer4Option

WithLayer4ICMPv4 specifies that the Layer4 should be ICMPv4.

func WithLayer4ICMPv6

func WithLayer4ICMPv6() Layer4Option

WithLayer4ICMPv6 specifies that the Layer4 should be ICMPv6.

func WithLayer4SCTP added in v0.4.0

func WithLayer4SCTP() Layer4Option

WithLayer4SCTP specifies that the Layer4 should be SCTP.

func WithLayer4SourcePort added in v0.4.0

func WithLayer4SourcePort(port uint32) Layer4Option

WithLayer4SourcePort specifies the source port for UDP, TCP, and SCTP. Only useful in conjunction with either WithLayer4UDP, WithLayer4TCP, or WithLayer4SCTP.

func WithLayer4TCP

func WithLayer4TCP() Layer4Option

WithLayer4TCP specifies that the Layer4 should be TCP.

func WithLayer4TCPDestinationPort

func WithLayer4TCPDestinationPort(port uint32) Layer4Option

WithLayer4TCPDestinationPort specifies the TCP destination port for Layer4. Only useful in conjunction with WithLayer4TCP. Deprecated: use WithLayer4DestinationPort instead.

func WithLayer4TCPFlags

func WithLayer4TCPFlags(flags TCPFlags) Layer4Option

WithLayer4TCPFlags specifies the TCP flags for Layer4. Only useful in conjunction with WithLayer4TCP.

func WithLayer4TCPSourcePort

func WithLayer4TCPSourcePort(port uint32) Layer4Option

WithLayer4TCPSourcePort specifies the TCP source port for Layer4. Only useful in conjunction with WithLayer4TCP. Deprecated: use WithLayer4SourcePort instead.

func WithLayer4UDP

func WithLayer4UDP() Layer4Option

WithLayer4UDP specifies that the Layer4 should be UDP.

func WithLayer4UDPDestinationPort

func WithLayer4UDPDestinationPort(port uint32) Layer4Option

WithLayer4UDPDestinationPort specifies the UDP destination port. Only useful in conjunction with WithLayer4UDP. Deprecated: use WithLayer4DestinationPort instead.

func WithLayer4UDPSourcePort

func WithLayer4UDPSourcePort(port uint32) Layer4Option

WithLayer4UDPSourcePort specifies the UDP source port. Only useful in conjunction with WithLayer4UDP. Deprecated: use WithLayer4SourcePort instead.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is an option to use with Flow.

func WithFlowAuthType added in v0.6.0

func WithFlowAuthType(t flowpb.AuthType) Option

WithFlowAuthType sets the authentication type field of a flow.

func WithFlowDestinationNames

func WithFlowDestinationNames(names []string) Option

WithFlowDestinationNames sets the destination names field of a flow.

func WithFlowDropReason

func WithFlowDropReason(r flowpb.DropReason) Option

WithFlowDropReason sets the drop reason of a flow.

func WithFlowEndpoints

func WithFlowEndpoints(src, dst *flowpb.Endpoint) Option

WithFlowEndpoints sets the source and destination endpoints of a flow.

func WithFlowEthernet

func WithFlowEthernet(e *flowpb.Ethernet) Option

WithFlowEthernet sets the ethernet field a flow.

func WithFlowIP

func WithFlowIP(ip *flowpb.IP) Option

WithFlowIP sets the IP field of a flow.

func WithFlowL4

func WithFlowL4(l4 *flowpb.Layer4) Option

WithFlowL4 sets the L4 field of a flow.

func WithFlowNodeName

func WithFlowNodeName(name string) Option

WithFlowNodeName sets the node name field of a flow.

func WithFlowSourceNames

func WithFlowSourceNames(names []string) Option

WithFlowSourceNames sets the source names field of a flow.

func WithFlowTime

func WithFlowTime(t time.Time) Option

WithFlowTime sets the time of a flow.

func WithFlowType

func WithFlowType(t flowpb.FlowType) Option

WithFlowType sets the type of the flow.

func WithFlowVerdict

func WithFlowVerdict(v flowpb.Verdict) Option

WithFlowVerdict sets the verdict of a flow.

func WithTraceContextProbability added in v0.3.0

func WithTraceContextProbability(probability float64) Option

WithTraceContextProbability defines the probability for a flow to contain a trace context. The value must be between 0 and 1. Defaults to 0.1.

type ServiceOption

type ServiceOption interface {
	// contains filtered or unexported methods
}

ServiceOption is an option to use with Service.

func WithServiceName

func WithServiceName(name string) ServiceOption

WithServiceName sets the name of the service.

func WithServiceNamespace

func WithServiceNamespace(ns string) ServiceOption

WithServiceNamespace sets the namespace of the service.

type TCPFlags

type TCPFlags uint16

TCPFlags represents a set TCP flags.

const (
	TCPFlagFIN TCPFlags = 1 << iota
	TCPFlagSYN
	TCPFlagRST
	TCPFlagPSH
	TCPFlagACK
	TCPFlagURG
	TCPFlagECE
	TCPFlagCWR
	TCPFlagNS
)

These constants represent possible individual TCP flags.

type TraceContextOption added in v0.3.0

type TraceContextOption interface {
	// contains filtered or unexported methods
}

TraceContextOption is an option to use with TraceContext.

func WithTraceIDs added in v0.3.0

func WithTraceIDs(traceIDs []string) TraceContextOption

WithTraceIDs defines a set of trace IDs to select from when generating trace contexts.

type VerdictOption

type VerdictOption interface {
	// contains filtered or unexported methods
}

VerdictOption is an option to use with Verdict.

func WithVerdictForwardedProbability

func WithVerdictForwardedProbability(probability float64) VerdictOption

WithVerdictForwardedProbability sets the probability of returning a forwarded verdict (defaults to 0.999). The value must be between 0 and 1.

Jump to

Keyboard shortcuts

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