types

package
v0.0.0-...-59efaf5 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_MSG_SIZE = 4096
View Source
const MAX_NET_FILTER_SIZE = 5

Variables

View Source
var FlowTypeName = map[FlowType]string{
	FLOW_UNKNOWN: "UNKNOWN",
	REQUEST:      "REQUEST",
	RESPONSE:     "RESPONSE",
}
View Source
var IpVersionName = map[IpVersion]string{
	IP_UNKNOWN: "UNKNOWN",
	IPv4:       "IPv4",
	IPv6:       "IPv6",
}
View Source
var Layer4TypeName = map[Layer4Type]string{
	LAYER4_UNKNOWN: "UNKNOWN",
	TCP:            "TCP",
	UDP:            "UDP",
}
View Source
var ProtocolTypeName = map[ProtocolType]string{
	PROTO_UNKNOWN: "UNKNOWN",
	HTTP1:         "HTTP/1",
	HTTP2:         "HTTP/2",
	MySQL:         "MySQL",
}

Functions

This section is empty.

Types

type EndpointKey

type EndpointKey struct {
	IpAddr    [16]byte
	IpVersion IpVersion
	Port      uint32
	Pid       uint32
}

func (*EndpointKey) String

func (ek *EndpointKey) String() string

type FlowType

type FlowType int32
const (
	FLOW_UNKNOWN FlowType = iota
	REQUEST
	RESPONSE
)

func (FlowType) String

func (f FlowType) String() string

type Ip

type Ip struct {
	Source      [16]byte
	Destination [16]byte
	IpVersion   IpVersion
}

func (*Ip) GetDestIp

func (ip *Ip) GetDestIp() string

func (*Ip) GetSrcIp

func (ip *Ip) GetSrcIp() string

func (*Ip) Protobuf

func (ip *Ip) Protobuf() *pb.IP

type IpNetwork

type IpNetwork struct {
	IpAddr [16]byte
	IpMask [16]byte
}

func ParseCIDR

func ParseCIDR(cidr string) (in IpNetwork, err error)

type IpNetworks

type IpNetworks struct {
	Data [MAX_NET_FILTER_SIZE]IpNetwork
	Size uint32
}

func ParseCIDRs

func ParseCIDRs(cidrs []string) (IpNetworks, error)

type IpVersion

type IpVersion int32
const (
	IP_UNKNOWN IpVersion = iota
	IPv4
	IPv6
)

func (IpVersion) String

func (i IpVersion) String() string

type Layer4

type Layer4 struct {
	SourcePort      uint32
	DestinationPort uint32
	L4Type          Layer4Type
}

func (*Layer4) Protobuf

func (l4 *Layer4) Protobuf() *pb.Layer4

type Layer4Type

type Layer4Type int32
const (
	LAYER4_UNKNOWN Layer4Type = iota
	TCP
	UDP
)

func (Layer4Type) String

func (l Layer4Type) String() string

type MsgEvent

type MsgEvent struct {
	Msg       [MAX_MSG_SIZE]byte
	SockKey   SockKey
	MsgSize   uint32
	Timestamp uint64
	FlowType  FlowType
	Protocol  ProtocolType
}

func (*MsgEvent) Bytes

func (msg *MsgEvent) Bytes() []byte

type ProtocolType

type ProtocolType int32
const (
	PROTO_UNKNOWN ProtocolType = iota
	PROTO_SKIP

	HTTP1
	HTTP2
	MySQL

	PROTO_RESERVED2
	PROTO_RESERVED3
	PROTO_RESERVED4
	PROTO_RESERVED5
)

func ProtoTypeOf

func ProtoTypeOf(protoStr string) ProtocolType

func ProtoTypesOf

func ProtoTypesOf(ps []string) ([]ProtocolType, error)

func (ProtocolType) String

func (p ProtocolType) String() string

type SockKey

type SockKey struct {
	Ip  Ip
	L4  Layer4
	Pid uint32
}

func (*SockKey) String

func (sk *SockKey) String() string

func (*SockKey) ToClinetEndpoint

func (sk *SockKey) ToClinetEndpoint() EndpointKey

func (*SockKey) ToServerEndpoint

func (sk *SockKey) ToServerEndpoint() EndpointKey

Jump to

Keyboard shortcuts

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