types

package
v4.1.14 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SIPSizeof   int = IPSizeOf
	DIPSizeof   int = IPSizeOf
	ProtoSizeof int = 1
	DportSizeof int = 2
)

Sizeof (entry) for all column types

View Source
const (
	TimeName     = "time"
	HostnameName = "host"
	HostIDName   = "hostid"
	IfaceName    = "iface"

	SIPName   = "sip"
	DIPName   = "dip"
	DportName = "dport"
	ProtoName = "proto"

	BytesRcvdName = "bytes_rcvd"
	BytesSentName = "bytes_sent"
	PktsRcvdName  = "pkts_rcvd"
	PktsSentName  = "pkts_sent"
)

Below enumerate the data type names used across goProbe

View Source
const (
	TalkConvCompoundQuery    = "talk_conv"
	TalkSrcCompoundQuery     = "talk_src"
	TalkDstCompoundQuery     = "talk_dst"
	AppsPortCompoundQuery    = "apps_port"
	AggTalkPortCompoundQuery = "agg_talk_port"
	RawCompoundQuery         = "raw"
)

Static shorthands for some column combinations

View Source
const (
	FormatJSON     = "json"     // JSON format
	FormatCSV      = "csv"      // CSV format
	FormatTXT      = "txt"      // Text / Shell output format
	FormatInfluxDB = "influxdb" // Influx DB format
)

Definition of format strings

View Source
const (
	KeyWidthIPv4 = sipDipIPv4Width + nonIPKeysWidth
	KeyWidthIPv6 = sipDipIPv6Width + nonIPKeysWidth
)

Basic constants used to simplify column width calculations

View Source
const (
	FilterKeywordDirection        = "dir"
	FilterKeywordDirectionSugared = "direction"
	FilterKeywordNone             = "none"
)

Filter-specific keywords

View Source
const (
	// incoming but no outgoing packets
	FilterTypeDirectionIn        = "in"
	FilterTypeDirectionInSugared = "inbound"
	// outgoing but no incoming packets
	FilterTypeDirectionOut        = "out"
	FilterTypeDirectionOutSugared = "outbound"
	// either only incoming or only outgoing packets
	FilterTypeDirectionUni        = "uni"
	FilterTypeDirectionUniSugared = "unidirectional"
	// both incoming and outgoing packets (excluding unidirectional traffic)
	FilterTypeDirectionBi        = "bi"
	FilterTypeDirectionBiSugared = "bidirectional"
)

Filter types / direction classifiers

View Source
const AnySelector = "any"

AnySelector denotes any / all (interfaces, hosts, ...)

View Source
const AttrSep = ","

AttrSep stores how query attributes are delimited in a query

View Source
const DefaultTimeOutputFormat = "2006-01-02 15:04:05"

DefaultTimeOutputFormat denotes the default time format to use when displaying time.Time information

View Source
const IPSizeOf = -1

IPSizeOf implies that the size of an IP column is variable (hence a negative number)

Variables

ColumnFileNames returns the name / title for each column

ColumnSizeofs returns the data sizes for each column

DirectionFilters denotes the list of all available direction filters

View Source
var ErrIncorrectIPAddrFormat = errors.New("IP parse: incorrect format")

ErrIncorrectIPAddrFormat denotes an invalid IP address string formatting

View Source
var MaxTime = time.Unix(1<<63-62135596801, 999999999)

MaxTime denotes the latest timestamp that can be used

Functions

func AllColumns

func AllColumns() []string

AllColumns returns a set of all column names / titles

func HasDNSAttributes

func HasDNSAttributes(attributes []Attribute) bool

HasDNSAttributes finds out if any of the attributes are usable for a reverse DNS lookup (e.g. check for IP attributes)

func IPStringToBytes

func IPStringToBytes(ip string) (ipData []byte, isIPv4 bool, err error)

IPStringToBytes creates a goDB compatible bytes slice from an IP address string and returns it alongside a boolean that denots if the address is IPv4 or not

func IsAnySelector

func IsAnySelector(input string) bool

IsAnySelector returns if the provided selector is "ANY" (case insensitive)

func IsIfaceArgumentRegExp

func IsIfaceArgumentRegExp(iface string) bool

func ParseQueryType

func ParseQueryType(queryType string) (attributes []Attribute, selector LabelSelector, err error)

ParseQueryType parses the given query type into a list of attributes. The returned list is guaranteed to have no duplicates. A valid query type can either be a comma-separated list of attribute names (e.g. "sip,dip,dport") or something like "talk_conv". The return variable hasAttrTime indicates whether the special time attribute is present. (time is never a part of the returned attribute list.) The time attribute is present for the query type 'raw', or if it is explicitly mentioned in a list of attribute names.

func PortToUint16

func PortToUint16(b []byte) uint16

PortToUint16 converts a uint16 number to a port

func PrettyIndent

func PrettyIndent(p Prettier, n int) string

PrettyIndent takes the output from a Prettier and indents it by n spaces

func RawIPToAddr

func RawIPToAddr(ip []byte) netip.Addr

RawIPToAddr converts an ip byte slice to an actual netip.Addr

func RawIPToString

func RawIPToString(ip []byte) string

RawIPToString converts an ip byte slice to string

func SanitizeQueryType

func SanitizeQueryType(query string) string

SanitizeQueryType will resolve all aliases and reconstruct the query string

func ShouldPretty

func ShouldPretty(err error, msg string) error

ShouldPretty attempts to pretty-print an error (if it fulfills the Prettier interface)

func Tokenize

func Tokenize(queryType string) (tokens []string)

Tokenize translates query abbreviations into the attributes they hold

func ValidateAndExtractRegExp

func ValidateAndExtractRegExp(regExp string) (*regexp.Regexp, error)

func ValidateAndSeparateFilters

func ValidateAndSeparateFilters(ifaceList string) ([]string, []string, error)

func ValidateIfaceArgument

func ValidateIfaceArgument(ifaceArgument string) ([]string, error)

This function is used to validate the input and to jugde if interfaces should be displayed in output table

func ValidateIfaceName

func ValidateIfaceName(iface string) error

func ValidateRegExp

func ValidateRegExp(regExp string) (*regexp.Regexp, error)

Types

type Attribute

type Attribute interface {
	// the attribute needs to be able to represent itself as a String
	fmt.Stringer

	// an Attribute is a columnn
	Column

	// Resolvable defines whether the attribute can be resolved via a DNS
	// reverse lookup
	Resolvable() bool
	// contains filtered or unexported methods
}

Attribute interface. It is not meant to be implemented by structs outside this package

func NewAttribute

func NewAttribute(name string) (Attribute, error)

NewAttribute returns an attribute for the given name. If no such attribute exists, an error is returned.

type Column

type Column interface {
	Name() string
	Width() Width
}

Column denotes a generic column and enforces the existence of certain methods

type ColumnIndex

type ColumnIndex int

ColumnIndex denotes a static index for one of the supported DB columns

const (
	// First the attribute columns...
	SIPColIdx, _ ColumnIndex = iota, iota
	DIPColIdx, _
	ProtoColIdx, _
	DportColIdx, _

	// ... and then the columns we aggregate
	BytesRcvdColIdx, ColIdxAttributeCount
	BytesSentColIdx, _
	PacketsRcvdColIdx, _
	PacketsSentColIdx, _
	ColIdxCount, _
)

Indices for all column types

func (ColumnIndex) IsCounterCol

func (c ColumnIndex) IsCounterCol() bool

IsCounterCol returns if a column is a counter (and hence does not use fixed-width encoding)

type Counters

type Counters struct {
	BytesRcvd   uint64 `json:"br,omitempty" doc:"Bytes received" example:"1024" minimum:"0"` // BytesRcvd: bytes received
	BytesSent   uint64 `json:"bs,omitempty" doc:"Bytes sent" example:"512" minimum:"0"`      // BytesSent: bytes sent
	PacketsRcvd uint64 `json:"pr,omitempty" doc:"Packets received" example:"2" minimum:"0"`  // PacketRcvd: packets received
	PacketsSent uint64 `json:"ps,omitempty" doc:"Packets sent" example:"1" minimum:"0"`      // PacketSent: packets sent
}

Counters stores the goProbe flow counters (and, where required, some extensions)

func (*Counters) Add

func (c *Counters) Add(c2 Counters)

Add adds the values from a different counter (in place)

func (Counters) IsBidirectional

func (c Counters) IsBidirectional() bool

IsBidirectional returns if a set of counters represents bidrectional traffic

func (Counters) IsOnlyInbound

func (c Counters) IsOnlyInbound() bool

IsOnlyInbound returns if a set of counters represents traffic that is only inbound

func (Counters) IsOnlyOutbound

func (c Counters) IsOnlyOutbound() bool

IsOnlyOutbound returns if a set of counters represents traffic that is only outbound

func (Counters) IsUnidirectional

func (c Counters) IsUnidirectional() bool

IsUnidirectional returns if a set of counters represents unidirectional traffic

func (Counters) String

func (c Counters) String() string

String prints the flow counters

func (*Counters) Sub

func (c *Counters) Sub(c2 Counters)

Sub subtracts the values from a different counter (in place)

func (Counters) SumBytes

func (c Counters) SumBytes() uint64

SumBytes sums the bytes received and sent directions

func (Counters) SumPackets

func (c Counters) SumPackets() uint64

SumPackets sums the packet received and sent directions

type DIPAttribute

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

DIPAttribute implements the destination IP attribute

func (DIPAttribute) Name

func (DIPAttribute) Name() string

Name returns the attribute's name

func (DIPAttribute) Resolvable

func (DIPAttribute) Resolvable() bool

Resolvable defines whether the attribute can be resolved via a DNS

func (DIPAttribute) String

func (i DIPAttribute) String() string

String returns the string representation of the attribute

func (DIPAttribute) Width

func (i DIPAttribute) Width() Width

Width returns the amount of bytes the IP attribute takes up on disk

type Direction

type Direction int

Direction indicates the counters of which flow direction we should print.

const (
	DirectionUnknown Direction = iota
	DirectionSum               // sum of inbound and outbound counters
	DirectionIn                // inbound counters
	DirectionOut               // outbound counters
	DirectionBoth              // inbound and outbound counters
)

Enumeration of directions to be considered

func DirectionFromString

func DirectionFromString(s string) Direction

DirectionFromString maps a string to a Direction

func (*Direction) MarshalJSON

func (d *Direction) MarshalJSON() ([]byte, error)

MarshalJSON implements the Marshaler interface for sort order

func (Direction) String

func (d Direction) String() string

String implement human-readable printing of the direction

func (*Direction) UnmarshalJSON

func (d *Direction) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the Unmarshaler interface

type DportAttribute

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

DportAttribute implements the destination port attribute

func (DportAttribute) Name

func (DportAttribute) Name() string

Name returns the destination port attribute name

func (DportAttribute) Resolvable

func (DportAttribute) Resolvable() bool

Resolvable returns if the destination port is resolvable

func (DportAttribute) String

func (d DportAttribute) String() string

String returns the string representation of the destination port attribute

func (DportAttribute) ToUint16

func (d DportAttribute) ToUint16() uint16

ToUint16 converts the destination port to a uint16 representation

func (DportAttribute) Width

func (DportAttribute) Width() Width

Width returns the amount of bytes the destination port attribute takes up on disk

type ExtendedKey

type ExtendedKey []byte

ExtendedKey is a Key with supplemental information

func (ExtendedKey) AttrTime

func (e ExtendedKey) AttrTime() (int64, bool)

AttrTime retrieves the time extension (indicating its presence via the second result parameter)

func (ExtendedKey) Clone

func (e ExtendedKey) Clone() ExtendedKey

Clone provides a copy of the extended key

func (ExtendedKey) GetDIP

func (e ExtendedKey) GetDIP() []byte

GetDIP retrieves the destination IP from the key

func (ExtendedKey) GetDport

func (e ExtendedKey) GetDport() []byte

GetDport retrieves the destination port from the key

func (ExtendedKey) GetProto

func (e ExtendedKey) GetProto() byte

GetProto retrieves the protocol from the key

func (ExtendedKey) GetSIP

func (e ExtendedKey) GetSIP() []byte

GetSIP retrieves the source IP from the key

func (ExtendedKey) IsIPv4

func (e ExtendedKey) IsIPv4() bool

IsIPv4 returns if the key represents an IPv4 packet / flow

func (ExtendedKey) Key

func (e ExtendedKey) Key() Key

Key retrieves the basic key within the extended key to allow for more precise access without having to always use the (longer) ExtendedKey

func (ExtendedKey) PutDIP

func (e ExtendedKey) PutDIP(dip []byte)

PutDIP stores a destination IP in the key

func (ExtendedKey) PutDIPV

func (e ExtendedKey) PutDIPV(dip []byte, isIPv4 bool)

PutDIPV stores a destination IP in the key (depending on the IP protocol version)

func (ExtendedKey) PutDIPV4

func (e ExtendedKey) PutDIPV4(dip []byte)

PutDIPV4 stores a destination IP in the key (assuming it is an IPv4 key)

func (ExtendedKey) PutDIPV6

func (e ExtendedKey) PutDIPV6(dip []byte)

PutDIPV6 stores a destination IP in the key (assuming it is an IPv6 key)

func (ExtendedKey) PutDport

func (e ExtendedKey) PutDport(dport []byte)

PutDport stores a destination port in the key

func (ExtendedKey) PutDportV

func (e ExtendedKey) PutDportV(dport []byte, isIPv4 bool)

PutDportV stores a destination port in the key (depending on the IP protocol version)

func (ExtendedKey) PutDportV4

func (e ExtendedKey) PutDportV4(dport []byte)

PutDportV4 stores a destination port in the key (assuming it is an IPv4 key)

func (ExtendedKey) PutDportV6

func (e ExtendedKey) PutDportV6(dport []byte)

PutDportV6 stores a destination port in the key (assuming it is an IPv6 key)

func (ExtendedKey) PutProto

func (e ExtendedKey) PutProto(proto byte)

PutProto stores a protocol in the key

func (ExtendedKey) PutProtoV

func (e ExtendedKey) PutProtoV(proto byte, isIPv4 bool)

PutProtoV stores a protocol in the key (depending on the IP protocol version)

func (ExtendedKey) PutProtoV4

func (e ExtendedKey) PutProtoV4(proto byte)

PutProtoV4 stores a protocol in the key (assuming it is an IPv4 key)

func (ExtendedKey) PutProtoV6

func (e ExtendedKey) PutProtoV6(proto byte)

PutProtoV6 stores a protocol in the key (assuming it is an IPv6 key)

func (ExtendedKey) PutSIP

func (e ExtendedKey) PutSIP(sip []byte)

PutSIP stores a source IP in the key

type IPVersion

type IPVersion int

IPVersion denotes the IP layer version (if any) of a conditional node

const (
	IPVersionNone IPVersion = iota // IPVersionNone : Not an IP related node
	IPVersionBoth                  // IPVersionBoth : Node contains subnodes with both IP layer versions

	IPVersionV4 // IPVersionV4 : IPv4 related node
	IPVersionV6 // IPVersionV6 : IPv6 related node
)

func (IPVersion) IsLimited

func (v IPVersion) IsLimited() bool

IsLimited returns if the IP layer version is limited (i.e. not none or both)

func (IPVersion) Merge

func (v IPVersion) Merge(v2 IPVersion) IPVersion

Merge combines two IPVersion instances

type InterfaceLister

type InterfaceLister interface {
	ListInterfaces() ([]string, error)
}

type Key

type Key []byte

Key stores the 5-tuple which defines a goProbe flow

func NewEmptyV4Key

func NewEmptyV4Key() Key

NewEmptyV4Key creates / allocates an emty key for IPV4

func NewEmptyV6Key

func NewEmptyV6Key() Key

NewEmptyV6Key creates / allocates an emty key for IPV6

func NewKey

func NewKey(sip, dip, dport []byte, proto byte) (key Key)

NewKey creates and populates a new key, determining IPv4 / IPv6 automatically from the length of the sip / dip inputs

func NewV4Key

func NewV4Key(sip, dip, dport []byte, proto byte) (key Key)

NewV4Key creates and populates a new key for IPv4

func NewV4KeyStatic

func NewV4KeyStatic(sip, dip [4]byte, dport []byte, proto byte) Key

NewV4KeyStatic creates / allocates an emty key for IPV4 (parsing IPs from arrays)

func NewV6Key

func NewV6Key(sip, dip, dport []byte, proto byte) (key Key)

NewV6Key creates and populates a new key for IPv6

func NewV6KeyStatic

func NewV6KeyStatic(sip, dip [16]byte, dport []byte, proto byte) Key

NewV6KeyStatic creates / allocates an emty key for IPV6 (parsing IPs from arrays)

func (Key) Clone

func (k Key) Clone() Key

Clone provides a copy of the key

func (Key) Extend

func (k Key) Extend(ts int64) (e ExtendedKey)

Extend extends a "normal" key by wrapping it in an "ExtendedKey" and appending any additional parameters to it

func (Key) ExtendEmpty

func (k Key) ExtendEmpty() (e ExtendedKey)

ExtendEmpty extends a "normal" key by wrapping it in an "ExtendedKey", filling no additional information

func (Key) GetDIP

func (k Key) GetDIP() []byte

GetDIP retrieves the destination IP from the key

func (Key) GetDport

func (k Key) GetDport() []byte

GetDport retrieves the destination port from the key

func (Key) GetProto

func (k Key) GetProto() byte

GetProto retrieves the protocol from the key

func (Key) GetSIP

func (k Key) GetSIP() []byte

GetSIP retrieves the source IP from the key

func (Key) IsIPv4

func (k Key) IsIPv4() bool

IsIPv4 returns if a key represents an IPv4 flow (based on its length)

func (Key) Len

func (k Key) Len() int

Len returns the length of the key (e.g. to determine the IP version)

func (Key) PutAllV4

func (k Key) PutAllV4(sip, dip, dport []byte, proto byte)

PutAllV4 stores all elements into an existing key (assuming it is an IPv4 key)

func (Key) PutAllV6

func (k Key) PutAllV6(sip, dip, dport []byte, proto byte)

PutAllV6 stores all elements into an existing key (assuming it is an IPv6 key)

func (Key) PutDIP

func (k Key) PutDIP(dip []byte)

PutDIP stores a destination IP in the key

func (Key) PutDIPV

func (k Key) PutDIPV(dip []byte, isIPv4 bool)

PutDIPV stores a destination IP in the key (depending on the IP protocol version)

func (Key) PutDIPV4

func (k Key) PutDIPV4(dip []byte)

PutDIPV4 stores a destination IP in the key (assuming it is an IPv4 key)

func (Key) PutDIPV6

func (k Key) PutDIPV6(dip []byte)

PutDIPV6 stores a destination IP in the key (assuming it is an IPv6 key)

func (Key) PutDport

func (k Key) PutDport(dport []byte)

PutDport stores a destination port in the key

func (Key) PutDportV

func (k Key) PutDportV(dport []byte, isIPv4 bool)

PutDportV stores a destination port in the key (depending on the IP protocol version)

func (Key) PutDportV4

func (k Key) PutDportV4(dport []byte)

PutDportV4 stores a destination port in the key (assuming it is an IPv4 key)

func (Key) PutDportV6

func (k Key) PutDportV6(dport []byte)

PutDportV6 stores a destination port in the key (assuming it is an IPv6 key)

func (Key) PutProto

func (k Key) PutProto(proto byte)

PutProto stores a protocol in the key

func (Key) PutProtoV

func (k Key) PutProtoV(proto byte, isIPv4 bool)

PutProtoV stores a protocol in the key (depending on the IP protocol version)

func (Key) PutProtoV4

func (k Key) PutProtoV4(proto byte)

PutProtoV4 stores a protocol in the key (assuming it is an IPv4 key)

func (Key) PutProtoV6

func (k Key) PutProtoV6(proto byte)

PutProtoV6 stores a protocol in the key (assuming it is an IPv6 key)

func (Key) PutSIP

func (k Key) PutSIP(sip []byte)

PutSIP stores a source IP in the key

func (Key) PutV4String

func (k Key) PutV4String(epHashKey string)

PutV4String stores all elements into an existing key (assuming it is an IPv4 key) based on the string representation of an EPHashV4 Note: Array indeces must match definitions in packet.go (not used here to avoid import cycle)

func (Key) PutV6String

func (k Key) PutV6String(epHashKey string)

PutV6String stores all elements into an existing key (assuming it is an IPv6 key) based on the string representation of an EPHashV6 Note: Array indeces must match definitions in packet.go (not used here to avoid import cycle)

func (Key) String

func (k Key) String() string

String prints the key as a comma separated attribute list

type LabelSelector

type LabelSelector struct {
	Timestamp bool `json:"timestamp,omitempty"`
	Iface     bool `json:"iface,omitempty"`
	Hostname  bool `json:"hostname,omitempty"`
	HostID    bool `json:"host_id,omitempty"`
}

LabelSelector defines a selector based on several conditions / parameters

type MaxBoundsError

type MaxBoundsError struct {
	Val string       `json:"val,omitempty"` // Val: values that is above the upper bounds
	Max *boundsError `json:"max"`           // Max: upper bound
}

MaxBoundsError stores an error communicating that a value is below a permitted value

func NewMaxBoundsError

func NewMaxBoundsError(val, max string, inclusive bool) *MaxBoundsError

func (*MaxBoundsError) Error

func (err *MaxBoundsError) Error() string

type MinBoundsError

type MinBoundsError struct {
	Val string       `json:"val,omitempty"` // Val: value that is below the lower bounds
	Min *boundsError `json:"min"`           // Min: lower bound
}

MinBoundsError stores an error communicating thata a value is below a permitted value

func NewMinBoundsError

func NewMinBoundsError(val, min string, inclusive bool) *MinBoundsError

func (*MinBoundsError) Error

func (err *MinBoundsError) Error() string

type ParseError

type ParseError struct {
	Tokens      []string `json:"tokens"`        // Tokens: the individual tokens parsed. Example: ["dip", "=", "1.2.3.4"]
	Pos         int      `json:"pos"`           // Pos: position at which the parser found the erorr. Example: 2
	Description string   `json:"description"`   // Description: description of the erroneous state
	Sep         string   `json:"sep,omitempty"` // Sep: separator that was used to tokenize. Example: " "
}

ParseError stores an error encountered during tokenized parsing

func NewParseError

func NewParseError(tokens []string, pos int, sep, description string, args ...any) *ParseError

NewParseError creates a new ParseError. The parameter "sep" will guide how tokens are re-assembled

func (*ParseError) Error

func (err *ParseError) Error() string

func (*ParseError) LogValue

func (err *ParseError) LogValue() slog.Value

func (*ParseError) Pretty

func (err *ParseError) Pretty() string

Pretty implements the Prettier interface

type Prettier

type Prettier interface {
	Pretty() string
}

Prettier is an interface allowing types to pretty-print themselves. Think of it as a nicer version of String. Meant to be used for cases where a human being consumes the output directly

type ProtoAttribute

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

ProtoAttribute implements the IP protocol attribute

func (ProtoAttribute) Name

func (ProtoAttribute) Name() string

Name returns the IP protocol attribute's name

func (ProtoAttribute) Resolvable

func (ProtoAttribute) Resolvable() bool

Resolvable returns if the IP protocol attribute is resolvable

func (ProtoAttribute) String

func (p ProtoAttribute) String() string

String returns the string representation of the IP protocol attribute

func (ProtoAttribute) Width

func (ProtoAttribute) Width() Width

Width returns the amount of bytes the IP protocol attribute takes up on disk

type RangeError

type RangeError struct {
	Val string       `json:"val,omitempty"` // Val: value that doesn't fit into the range
	Min *boundsError `json:"min"`           // Min: lower bound
	Max *boundsError `json:"max"`           // Max: upper bound
}

RangeError stores an error where a value is not within a predefined range. It is the caller's responsibility to make sure that Val is actually conflicting with Min/Max. Otherwise, there's no point to instantiate the error in the first place

func NewRangeError

func NewRangeError(val, min string, includeMin bool, max string, includeMax bool) *RangeError

NewRangeError instantiates a new RangeError

func (*RangeError) Error

func (err *RangeError) Error() string

type SIPAttribute

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

SIPAttribute implements the source IP attribute

func (SIPAttribute) Name

func (SIPAttribute) Name() string

Name returns the attributes name

func (SIPAttribute) Resolvable

func (SIPAttribute) Resolvable() bool

Resolvable defines whether the attribute can be resolved via a DNS

func (SIPAttribute) String

func (i SIPAttribute) String() string

String returns the string representation of the attribute

func (SIPAttribute) Width

func (i SIPAttribute) Width() Width

Width returns the amount of bytes the IP attribute takes up on disk

type Status

type Status string

Status denotes a generic execution status for display

const (
	StatusError           Status = "error"
	StatusEmpty           Status = "empty"
	StatusMissingData     Status = "missing_data"
	StatusTooManyRequests Status = "too many requests"
	StatusOK              Status = "ok"
)

Definition of some common status results

type UnsupportedError

type UnsupportedError struct {
	Val   string   `json:"val"`   // Val: the value not part of Valid. Example: biscuits
	Valid []string `json:"valid"` // Valid: the permitted values. Example: ["csv", "json", "text"]
}

UnsupportedError stores an error communicating that a value is not included in a set of values

func NewUnsupportedError

func NewUnsupportedError(val string, valid []string) *UnsupportedError

func (*UnsupportedError) Error

func (err *UnsupportedError) Error() string

type Width

type Width = int

Width denotes the on-screen column width based on column type

const (
	IPv6Width  Width = 16
	IPv4Width  Width = 4
	DPortWidth Width = 2
	ProtoWidth Width = 1

	TimestampWidth Width = 8
)

Widths for all used columns

Directories

Path Synopsis
Package hashmap implemets a modified version of Go's map type using type parameters.
Package hashmap implemets a modified version of Go's map type using type parameters.

Jump to

Keyboard shortcuts

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