common

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: BSD-3-Clause Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	FORMAT_TYPE_UNKNOWN = iota
	FORMAT_TYPE_STRING_FUNC
	FORMAT_TYPE_STRING
	FORMAT_TYPE_INTEGER
	FORMAT_TYPE_IP
	FORMAT_TYPE_MAC
	FORMAT_TYPE_BYTES
)

Variables

View Source
var (
	EtypeName = map[uint32]string{
		0x806:  "ARP",
		0x800:  "IPv4",
		0x86dd: "IPv6",
	}
	ProtoName = map[uint32]string{
		1:   "ICMP",
		6:   "TCP",
		17:  "UDP",
		58:  "ICMPv6",
		132: "SCTP",
	}
	IcmpTypeName = map[uint32]string{
		0:  "EchoReply",
		3:  "DestinationUnreachable",
		8:  "Echo",
		9:  "RouterAdvertisement",
		10: "RouterSolicitation",
		11: "TimeExceeded",
	}
	Icmp6TypeName = map[uint32]string{
		1:   "DestinationUnreachable",
		2:   "PacketTooBig",
		3:   "TimeExceeded",
		128: "EchoRequest",
		129: "EchoReply",
		133: "RouterSolicitation",
		134: "RouterAdvertisement",
	}

	TextFields = []string{
		"Type",
		"TimeReceived",
		"SequenceNum",
		"SamplingRate",
		"SamplerAddress",
		"TimeFlowStart",
		"TimeFlowEnd",
		"Bytes",
		"Packets",
		"SrcAddr",
		"DstAddr",
		"Etype",
		"Proto",
		"SrcPort",
		"DstPort",
		"InIf",
		"OutIf",
		"SrcMac",
		"DstMac",
		"SrcVlan",
		"DstVlan",
		"VlanId",
		"IngressVrfID",
		"EgressVrfID",
		"IPTos",
		"ForwardingStatus",
		"IPTTL",
		"TCPFlags",
		"IcmpType",
		"IcmpCode",
		"IPv6FlowLabel",
		"FragmentId",
		"FragmentOffset",
		"BiFlowDirection",
		"SrcAS",
		"DstAS",
		"NextHop",
		"NextHopAS",
		"SrcNet",
		"DstNet",
	}
	TextFieldsTypes = []int{
		FORMAT_TYPE_STRING_FUNC,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_IP,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_IP,
		FORMAT_TYPE_IP,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_MAC,
		FORMAT_TYPE_MAC,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_IP,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
		FORMAT_TYPE_INTEGER,
	}
	RenderExtras = []string{
		"EtypeName",
		"ProtoName",
		"IcmpName",
	}
	RenderExtraCall = []RenderExtraFunction{
		RenderExtraFunctionEtypeName,
		RenderExtraFunctionProtoName,
		RenderExtraFunctionIcmpName,
	}
)

Functions

func AddTextField

func AddTextField(name string, jtype int)

func FormatMessageReflectCustom

func FormatMessageReflectCustom(msg proto.Message, ext, quotes, sep, sign string, null bool) string

func FormatMessageReflectJSON

func FormatMessageReflectJSON(msg proto.Message, ext string) string

func FormatMessageReflectText

func FormatMessageReflectText(msg proto.Message, ext string) string

func HashFlag

func HashFlag()

func HashProto

func HashProto(fields []string, msg interface{}) string

func HashProtoLocal

func HashProtoLocal(msg interface{}) string

func IcmpCodeType

func IcmpCodeType(proto, icmpCode, icmpType uint32) string

func ManualHashInit

func ManualHashInit() error

func ManualSelectorInit

func ManualSelectorInit() error

func RenderExtraFetchNumbers

func RenderExtraFetchNumbers(msg proto.Message, fields []string) []uint64

func RenderExtraFunctionEtypeName

func RenderExtraFunctionEtypeName(msg proto.Message) string

func RenderExtraFunctionIcmpName

func RenderExtraFunctionIcmpName(msg proto.Message) string

func RenderExtraFunctionProtoName

func RenderExtraFunctionProtoName(msg proto.Message) string

func RenderIP

func RenderIP(addr []byte) string

func SelectorFlag

func SelectorFlag()

Types

type RenderExtraFunction

type RenderExtraFunction func(proto.Message) string

Jump to

Keyboard shortcuts

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