common

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2023 License: BSD-3-Clause Imports: 7 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 = map[string]int{
		"Type":           FORMAT_TYPE_STRING_FUNC,
		"SamplerAddress": FORMAT_TYPE_IP,
		"SrcAddr":        FORMAT_TYPE_IP,
		"DstAddr":        FORMAT_TYPE_IP,
		"SrcMac":         FORMAT_TYPE_MAC,
		"DstMac":         FORMAT_TYPE_MAC,
		"NextHop":        FORMAT_TYPE_IP,
		"MPLSLabelIP":    FORMAT_TYPE_IP,
	}

	RenderExtras = map[string]RenderExtraFunction{
		"EtypeName": RenderExtraFunctionEtypeName,
		"ProtoName": RenderExtraFunctionProtoName,
		"IcmpName":  RenderExtraFunctionIcmpName,
	}
)

Functions

func ExtractTag added in v1.2.0

func ExtractTag(name, original string, tag reflect.StructTag) string

func FormatMessageReflectCustom

func FormatMessageReflectCustom(msg interface{}, ext, quotes, sep, sign string, null bool) string

func FormatMessageReflectJSON

func FormatMessageReflectJSON(msg interface{}, ext string) string

func FormatMessageReflectText

func FormatMessageReflectText(msg interface{}, 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 interface{}, fields []string) []uint64

func RenderExtraFunctionEtypeName

func RenderExtraFunctionEtypeName(msg interface{}) string

func RenderExtraFunctionIcmpName

func RenderExtraFunctionIcmpName(msg interface{}) string

func RenderExtraFunctionProtoName

func RenderExtraFunctionProtoName(msg interface{}) string

func RenderIP

func RenderIP(addr []byte) string

func SelectorFlag

func SelectorFlag()

Types

type RenderExtraFunction

type RenderExtraFunction func(interface{}) string

Jump to

Keyboard shortcuts

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