types

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TcpFlagsToByte

func TcpFlagsToByte(flags ...TcpFlag) byte

Types

type Config

type Config struct {
	Version  string   // internal field of the application version
	Exporter Exporter `yaml:"exporter"`
	NFTables NFTables `yaml:"nftables"`
	Counters Counters `yaml:"counters"`
}

type Counter

type Counter struct {
	Label    string     `yaml:"label"`
	SrcPort  uint16     `yaml:"src_port"`
	DstPort  uint16     `yaml:"dst_port"`
	TcpFlags []TcpFlag  `yaml:"tcp_flags"`
	Protocol Protocol   `yaml:"protocol"`
	SrcAddr  netip.Addr `yaml:"src_addr"`
	DstAddr  netip.Addr `yaml:"dst_addr"`
	Dir      string     // internal field to denote "input" or "output"
	Packets  uint64     // internal field to hold counter value
	Bytes    uint64     // internal field to hold byte count
}

type Counters

type Counters struct {
	Input  []Counter `yaml:"input"`
	Output []Counter `yaml:"output"`
}

type Exporter

type Exporter struct {
	Interval time.Duration `yaml:"interval"`
	OTLP     OTLP          `yaml:"otlp"`
}

type NFTables

type NFTables struct {
	Family        TableFamily `yaml:"family"`
	TableName     string      `yaml:"table_name"`
	ChainPriority int32       `yaml:"chain_priority"`
}

type OTLP

type OTLP struct {
	Endpoint string       `yaml:"endpoint"`
	Protocol OTLPProtocol `yaml:"protocol"`
	TLS      *TLSConfig   `yaml:"tls_config,omitempty"`
}

type OTLPProtocol

type OTLPProtocol string
const (
	OTLPProtocolGRPC   OTLPProtocol = "grpc"
	OTLPProtocolHTTP   OTLPProtocol = "http"
	OTLPProtocolStdout OTLPProtocol = "stdout"
)

func (*OTLPProtocol) UnmarshalYAML

func (p *OTLPProtocol) UnmarshalYAML(unmarshal func(interface{}) error) error

type Protocol

type Protocol uint8
const (
	ProtocolTCP    Protocol = unix.IPPROTO_TCP
	ProtocolUDP    Protocol = unix.IPPROTO_UDP
	ProtocolICMP   Protocol = unix.IPPROTO_ICMP
	ProtocolICMPv6 Protocol = unix.IPPROTO_ICMPV6
)

func ProtocolFromString

func ProtocolFromString(s string) Protocol

func (Protocol) AsSlice

func (p Protocol) AsSlice() []byte

func (Protocol) String

func (p Protocol) String() string

func (*Protocol) UnmarshalYAML

func (p *Protocol) UnmarshalYAML(unmarshal func(interface{}) error) error

type TLSConfig

type TLSConfig struct {
	CertFile string `yaml:"cert_file,omitempty"`
	KeyFile  string `yaml:"key_file,omitempty"`
	CAFile   string `yaml:"ca_file,omitempty"`
}

type TableFamily

type TableFamily uint8
const (
	TableFamilyIPv4 TableFamily = unix.NFPROTO_IPV4
	TableFamilyIPv6 TableFamily = unix.NFPROTO_IPV6
	// Not yet supported
	TableFamilyInet TableFamily = unix.NFPROTO_INET
)

func TableFamilyFromString

func TableFamilyFromString(s string) TableFamily

func (TableFamily) String

func (f TableFamily) String() string

func (*TableFamily) UnmarshalYAML

func (f *TableFamily) UnmarshalYAML(unmarshal func(interface{}) error) error

type TcpFlag

type TcpFlag uint8
const (
	TcpFlagFIN TcpFlag = 0x01
	TcpFlagSYN TcpFlag = 0x02
	TcpFlagRST TcpFlag = 0x04
	TcpFlagPSH TcpFlag = 0x08
	TcpFlagACK TcpFlag = 0x10
	TcpFlagURG TcpFlag = 0x20
	TcpFlagECE TcpFlag = 0x40
	TcpFlagCWR TcpFlag = 0x80
)

func TcpFlagFromString

func TcpFlagFromString(s string) TcpFlag

func TcpFlagsFromByte

func TcpFlagsFromByte(b byte) []TcpFlag

func (TcpFlag) String

func (f TcpFlag) String() string

func (*TcpFlag) UnmarshalText

func (f *TcpFlag) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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