pbflow

package
v1.6.1-crc1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2024 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Collector_Send_FullMethodName = "/pbflow.Collector/Send"
)

Variables

View Source
var (
	Direction_name = map[int32]string{
		0: "INGRESS",
		1: "EGRESS",
	}
	Direction_value = map[string]int32{
		"INGRESS": 0,
		"EGRESS":  1,
	}
)

Enum value maps for Direction.

View Source
var Collector_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "pbflow.Collector",
	HandlerType: (*CollectorServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Send",
			Handler:    _Collector_Send_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "proto/flow.proto",
}

Collector_ServiceDesc is the grpc.ServiceDesc for Collector service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_proto_flow_proto protoreflect.FileDescriptor

Functions

func PBToFlow

func PBToFlow(pb *Record) *flow.Record

func RegisterCollectorServer

func RegisterCollectorServer(s grpc.ServiceRegistrar, srv CollectorServer)

Types

type CollectorClient

type CollectorClient interface {
	Send(ctx context.Context, in *Records, opts ...grpc.CallOption) (*CollectorReply, error)
}

CollectorClient is the client API for Collector service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewCollectorClient

func NewCollectorClient(cc grpc.ClientConnInterface) CollectorClient

type CollectorReply

type CollectorReply struct {
	// contains filtered or unexported fields
}

intentionally empty

func (*CollectorReply) Descriptor deprecated

func (*CollectorReply) Descriptor() ([]byte, []int)

Deprecated: Use CollectorReply.ProtoReflect.Descriptor instead.

func (*CollectorReply) ProtoMessage

func (*CollectorReply) ProtoMessage()

func (*CollectorReply) ProtoReflect

func (x *CollectorReply) ProtoReflect() protoreflect.Message

func (*CollectorReply) Reset

func (x *CollectorReply) Reset()

func (*CollectorReply) String

func (x *CollectorReply) String() string

type CollectorServer

type CollectorServer interface {
	Send(context.Context, *Records) (*CollectorReply, error)
	// contains filtered or unexported methods
}

CollectorServer is the server API for Collector service. All implementations must embed UnimplementedCollectorServer for forward compatibility

type DataLink struct {
	SrcMac uint64 `protobuf:"varint,1,opt,name=src_mac,json=srcMac,proto3" json:"src_mac,omitempty"`
	DstMac uint64 `protobuf:"varint,2,opt,name=dst_mac,json=dstMac,proto3" json:"dst_mac,omitempty"`
	// contains filtered or unexported fields
}

func (*DataLink) Descriptor deprecated

func (*DataLink) Descriptor() ([]byte, []int)

Deprecated: Use DataLink.ProtoReflect.Descriptor instead.

func (*DataLink) GetDstMac

func (x *DataLink) GetDstMac() uint64

func (*DataLink) GetSrcMac

func (x *DataLink) GetSrcMac() uint64

func (*DataLink) ProtoMessage

func (*DataLink) ProtoMessage()

func (*DataLink) ProtoReflect

func (x *DataLink) ProtoReflect() protoreflect.Message

func (*DataLink) Reset

func (x *DataLink) Reset()

func (*DataLink) String

func (x *DataLink) String() string

type Direction

type Direction int32

as defined by field 61 in https://www.iana.org/assignments/ipfix/ipfix.xhtml

const (
	Direction_INGRESS Direction = 0
	Direction_EGRESS  Direction = 1
)

func (Direction) Descriptor

func (Direction) Descriptor() protoreflect.EnumDescriptor

func (Direction) Enum

func (x Direction) Enum() *Direction

func (Direction) EnumDescriptor deprecated

func (Direction) EnumDescriptor() ([]byte, []int)

Deprecated: Use Direction.Descriptor instead.

func (Direction) Number

func (x Direction) Number() protoreflect.EnumNumber

func (Direction) String

func (x Direction) String() string

func (Direction) Type

type DupMapEntry added in v0.3.3

type DupMapEntry struct {
	Interface string    `protobuf:"bytes,1,opt,name=interface,proto3" json:"interface,omitempty"`
	Direction Direction `protobuf:"varint,2,opt,name=direction,proto3,enum=pbflow.Direction" json:"direction,omitempty"`
	// contains filtered or unexported fields
}

func (*DupMapEntry) Descriptor deprecated added in v0.3.3

func (*DupMapEntry) Descriptor() ([]byte, []int)

Deprecated: Use DupMapEntry.ProtoReflect.Descriptor instead.

func (*DupMapEntry) GetDirection added in v0.3.3

func (x *DupMapEntry) GetDirection() Direction

func (*DupMapEntry) GetInterface added in v0.3.3

func (x *DupMapEntry) GetInterface() string

func (*DupMapEntry) ProtoMessage added in v0.3.3

func (*DupMapEntry) ProtoMessage()

func (*DupMapEntry) ProtoReflect added in v0.3.3

func (x *DupMapEntry) ProtoReflect() protoreflect.Message

func (*DupMapEntry) Reset added in v0.3.3

func (x *DupMapEntry) Reset()

func (*DupMapEntry) String added in v0.3.3

func (x *DupMapEntry) String() string

type IP

type IP struct {

	// Types that are assignable to IpFamily:
	//
	//	*IP_Ipv4
	//	*IP_Ipv6
	IpFamily isIP_IpFamily `protobuf_oneof:"ip_family"`
	// contains filtered or unexported fields
}

func (*IP) Descriptor deprecated

func (*IP) Descriptor() ([]byte, []int)

Deprecated: Use IP.ProtoReflect.Descriptor instead.

func (*IP) GetIpFamily

func (m *IP) GetIpFamily() isIP_IpFamily

func (*IP) GetIpv4

func (x *IP) GetIpv4() uint32

func (*IP) GetIpv6

func (x *IP) GetIpv6() []byte

func (*IP) ProtoMessage

func (*IP) ProtoMessage()

func (*IP) ProtoReflect

func (x *IP) ProtoReflect() protoreflect.Message

func (*IP) Reset

func (x *IP) Reset()

func (*IP) String

func (x *IP) String() string

type IP_Ipv4

type IP_Ipv4 struct {
	Ipv4 uint32 `protobuf:"fixed32,1,opt,name=ipv4,proto3,oneof"`
}

type IP_Ipv6

type IP_Ipv6 struct {
	Ipv6 []byte `protobuf:"bytes,2,opt,name=ipv6,proto3,oneof"`
}

type Network

type Network struct {
	SrcAddr *IP    `protobuf:"bytes,1,opt,name=src_addr,json=srcAddr,proto3" json:"src_addr,omitempty"`
	DstAddr *IP    `protobuf:"bytes,2,opt,name=dst_addr,json=dstAddr,proto3" json:"dst_addr,omitempty"`
	Dscp    uint32 `protobuf:"varint,3,opt,name=dscp,proto3" json:"dscp,omitempty"`
	// contains filtered or unexported fields
}

func (*Network) Descriptor deprecated

func (*Network) Descriptor() ([]byte, []int)

Deprecated: Use Network.ProtoReflect.Descriptor instead.

func (*Network) GetDscp added in v0.3.3

func (x *Network) GetDscp() uint32

func (*Network) GetDstAddr

func (x *Network) GetDstAddr() *IP

func (*Network) GetSrcAddr

func (x *Network) GetSrcAddr() *IP

func (*Network) ProtoMessage

func (*Network) ProtoMessage()

func (*Network) ProtoReflect

func (x *Network) ProtoReflect() protoreflect.Message

func (*Network) Reset

func (x *Network) Reset()

func (*Network) String

func (x *Network) String() string

type Record

type Record struct {

	// protocol as defined by ETH_P_* in linux/if_ether.h
	// https://github.com/torvalds/linux/blob/master/include/uapi/linux/if_ether.h
	EthProtocol   uint32                 `protobuf:"varint,1,opt,name=eth_protocol,json=ethProtocol,proto3" json:"eth_protocol,omitempty"`
	Direction     Direction              `protobuf:"varint,2,opt,name=direction,proto3,enum=pbflow.Direction" json:"direction,omitempty"`
	TimeFlowStart *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=time_flow_start,json=timeFlowStart,proto3" json:"time_flow_start,omitempty"`
	TimeFlowEnd   *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=time_flow_end,json=timeFlowEnd,proto3" json:"time_flow_end,omitempty"`
	// OSI-layer attributes
	DataLink  *DataLink  `protobuf:"bytes,5,opt,name=data_link,json=dataLink,proto3" json:"data_link,omitempty"`
	Network   *Network   `protobuf:"bytes,6,opt,name=network,proto3" json:"network,omitempty"`
	Transport *Transport `protobuf:"bytes,7,opt,name=transport,proto3" json:"transport,omitempty"`
	Bytes     uint64     `protobuf:"varint,8,opt,name=bytes,proto3" json:"bytes,omitempty"`
	Packets   uint64     `protobuf:"varint,9,opt,name=packets,proto3" json:"packets,omitempty"`
	Interface string     `protobuf:"bytes,10,opt,name=interface,proto3" json:"interface,omitempty"`
	// if true, the same flow has been recorded via another interface.
	// From all the duplicate flows, one will set this value to false and the rest will be true.
	Duplicate bool `protobuf:"varint,11,opt,name=duplicate,proto3" json:"duplicate,omitempty"`
	// Agent IP address to help identifying the source of the flow
	AgentIp                *IP                  `protobuf:"bytes,12,opt,name=agent_ip,json=agentIp,proto3" json:"agent_ip,omitempty"`
	Flags                  uint32               `protobuf:"varint,13,opt,name=flags,proto3" json:"flags,omitempty"`
	IcmpType               uint32               `protobuf:"varint,14,opt,name=icmp_type,json=icmpType,proto3" json:"icmp_type,omitempty"`
	IcmpCode               uint32               `protobuf:"varint,15,opt,name=icmp_code,json=icmpCode,proto3" json:"icmp_code,omitempty"`
	PktDropBytes           uint64               `protobuf:"varint,16,opt,name=pkt_drop_bytes,json=pktDropBytes,proto3" json:"pkt_drop_bytes,omitempty"`
	PktDropPackets         uint64               `protobuf:"varint,17,opt,name=pkt_drop_packets,json=pktDropPackets,proto3" json:"pkt_drop_packets,omitempty"`
	PktDropLatestFlags     uint32               `protobuf:"varint,18,opt,name=pkt_drop_latest_flags,json=pktDropLatestFlags,proto3" json:"pkt_drop_latest_flags,omitempty"`
	PktDropLatestState     uint32               `protobuf:"varint,19,opt,name=pkt_drop_latest_state,json=pktDropLatestState,proto3" json:"pkt_drop_latest_state,omitempty"`
	PktDropLatestDropCause uint32               `` /* 135-byte string literal not displayed */
	DnsId                  uint32               `protobuf:"varint,21,opt,name=dns_id,json=dnsId,proto3" json:"dns_id,omitempty"`
	DnsFlags               uint32               `protobuf:"varint,22,opt,name=dns_flags,json=dnsFlags,proto3" json:"dns_flags,omitempty"`
	DnsLatency             *durationpb.Duration `protobuf:"bytes,23,opt,name=dns_latency,json=dnsLatency,proto3" json:"dns_latency,omitempty"`
	TimeFlowRtt            *durationpb.Duration `protobuf:"bytes,24,opt,name=time_flow_rtt,json=timeFlowRtt,proto3" json:"time_flow_rtt,omitempty"`
	DnsErrno               uint32               `protobuf:"varint,25,opt,name=dns_errno,json=dnsErrno,proto3" json:"dns_errno,omitempty"`
	DupList                []*DupMapEntry       `protobuf:"bytes,26,rep,name=dup_list,json=dupList,proto3" json:"dup_list,omitempty"`
	// contains filtered or unexported fields
}

func FlowToPB

func FlowToPB(fr *flow.Record) *Record

FlowToPB is an auxiliary function to convert a single flow record, as returned by the eBPF agent, into a protobuf-encoded message ready to be sent to the collector via kafka

func (*Record) Descriptor deprecated

func (*Record) Descriptor() ([]byte, []int)

Deprecated: Use Record.ProtoReflect.Descriptor instead.

func (*Record) GetAgentIp added in v0.2.4

func (x *Record) GetAgentIp() *IP

func (*Record) GetBytes

func (x *Record) GetBytes() uint64
func (x *Record) GetDataLink() *DataLink

func (*Record) GetDirection

func (x *Record) GetDirection() Direction

func (*Record) GetDnsErrno added in v0.3.3

func (x *Record) GetDnsErrno() uint32

func (*Record) GetDnsFlags added in v0.3.2

func (x *Record) GetDnsFlags() uint32

func (*Record) GetDnsId added in v0.3.2

func (x *Record) GetDnsId() uint32

func (*Record) GetDnsLatency added in v0.3.2

func (x *Record) GetDnsLatency() *durationpb.Duration

func (*Record) GetDupList added in v0.3.3

func (x *Record) GetDupList() []*DupMapEntry

func (*Record) GetDuplicate added in v0.2.2

func (x *Record) GetDuplicate() bool

func (*Record) GetEthProtocol

func (x *Record) GetEthProtocol() uint32

func (*Record) GetFlags added in v0.2.4

func (x *Record) GetFlags() uint32

func (*Record) GetIcmpCode added in v0.3.2

func (x *Record) GetIcmpCode() uint32

func (*Record) GetIcmpType added in v0.3.2

func (x *Record) GetIcmpType() uint32

func (*Record) GetInterface

func (x *Record) GetInterface() string

func (*Record) GetNetwork

func (x *Record) GetNetwork() *Network

func (*Record) GetPackets

func (x *Record) GetPackets() uint64

func (*Record) GetPktDropBytes added in v0.3.2

func (x *Record) GetPktDropBytes() uint64

func (*Record) GetPktDropLatestDropCause added in v0.3.2

func (x *Record) GetPktDropLatestDropCause() uint32

func (*Record) GetPktDropLatestFlags added in v0.3.2

func (x *Record) GetPktDropLatestFlags() uint32

func (*Record) GetPktDropLatestState added in v0.3.2

func (x *Record) GetPktDropLatestState() uint32

func (*Record) GetPktDropPackets added in v0.3.2

func (x *Record) GetPktDropPackets() uint64

func (*Record) GetTimeFlowEnd

func (x *Record) GetTimeFlowEnd() *timestamppb.Timestamp

func (*Record) GetTimeFlowRtt added in v0.3.2

func (x *Record) GetTimeFlowRtt() *durationpb.Duration

func (*Record) GetTimeFlowStart

func (x *Record) GetTimeFlowStart() *timestamppb.Timestamp

func (*Record) GetTransport

func (x *Record) GetTransport() *Transport

func (*Record) ProtoMessage

func (*Record) ProtoMessage()

func (*Record) ProtoReflect

func (x *Record) ProtoReflect() protoreflect.Message

func (*Record) Reset

func (x *Record) Reset()

func (*Record) String

func (x *Record) String() string

type Records

type Records struct {
	Entries []*Record `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"`
	// contains filtered or unexported fields
}

func FlowsToPB

func FlowsToPB(inputRecords []*flow.Record, maxLen int) []*Records

FlowsToPB is an auxiliary function to convert flow records, as returned by the eBPF agent, into protobuf-encoded messages ready to be sent to the collector via GRPC

func (*Records) Descriptor deprecated

func (*Records) Descriptor() ([]byte, []int)

Deprecated: Use Records.ProtoReflect.Descriptor instead.

func (*Records) GetEntries

func (x *Records) GetEntries() []*Record

func (*Records) ProtoMessage

func (*Records) ProtoMessage()

func (*Records) ProtoReflect

func (x *Records) ProtoReflect() protoreflect.Message

func (*Records) Reset

func (x *Records) Reset()

func (*Records) String

func (x *Records) String() string

type Transport

type Transport struct {
	SrcPort uint32 `protobuf:"varint,1,opt,name=src_port,json=srcPort,proto3" json:"src_port,omitempty"`
	DstPort uint32 `protobuf:"varint,2,opt,name=dst_port,json=dstPort,proto3" json:"dst_port,omitempty"`
	// protocol as defined by IPPROTO_* in linux/in.h
	// https://github.com/torvalds/linux/blob/master/include/uapi/linux/in.h
	Protocol uint32 `protobuf:"varint,3,opt,name=protocol,proto3" json:"protocol,omitempty"`
	// contains filtered or unexported fields
}

func (*Transport) Descriptor deprecated

func (*Transport) Descriptor() ([]byte, []int)

Deprecated: Use Transport.ProtoReflect.Descriptor instead.

func (*Transport) GetDstPort

func (x *Transport) GetDstPort() uint32

func (*Transport) GetProtocol

func (x *Transport) GetProtocol() uint32

func (*Transport) GetSrcPort

func (x *Transport) GetSrcPort() uint32

func (*Transport) ProtoMessage

func (*Transport) ProtoMessage()

func (*Transport) ProtoReflect

func (x *Transport) ProtoReflect() protoreflect.Message

func (*Transport) Reset

func (x *Transport) Reset()

func (*Transport) String

func (x *Transport) String() string

type UnimplementedCollectorServer

type UnimplementedCollectorServer struct {
}

UnimplementedCollectorServer must be embedded to have forward compatible implementations.

func (UnimplementedCollectorServer) Send

type UnsafeCollectorServer

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

UnsafeCollectorServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to CollectorServer will result in compilation errors.

Jump to

Keyboard shortcuts

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