vtuple

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

helper functions to manage 5-tuples

Index

Constants

View Source
const (
	VT_IP4     = 0x4000
	VT_IP6     = 0x6000
	VT_L3_MASK = 0xff00

	// Let's use the actual TCP/UDP nextheader ids because why not?
	VT_TCP     = 0x06
	VT_UDP     = 0x11
	VT_L4_MASK = 0xff

	VT_TCP4 = VT_IP4 | VT_TCP
	VT_TCP6 = VT_IP6 | VT_TCP
	VT_UDP4 = VT_IP4 | VT_UDP
	VT_UDP6 = VT_IP6 | VT_UDP
)

Variables

This section is empty.

Functions

func StringRep

func StringRep(vt VTuple) string

Types

type Impl

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

func CreateTCPv4

func CreateTCPv4(saddr [4]byte, sport uint16, daddr [4]byte, dport uint16) Impl

func CreateUDPv4

func CreateUDPv4(saddr [4]byte, sport uint16, daddr [4]byte, dport uint16) Impl

func CreateVTupleV4

func CreateVTupleV4(proto byte, saddr [4]byte, sport uint16, daddr [4]byte, dport uint16) (Impl, error)

func (*Impl) DstAddr

func (t *Impl) DstAddr() netip.Addr

func (*Impl) DstPort

func (t *Impl) DstPort() uint16

func (*Impl) IsIP4

func (t *Impl) IsIP4() bool

func (*Impl) IsIP6

func (t *Impl) IsIP6() bool

func (*Impl) IsTCP

func (t *Impl) IsTCP() bool

func (*Impl) IsUDP

func (t *Impl) IsUDP() bool

func (*Impl) SrcAddr

func (t *Impl) SrcAddr() netip.Addr

func (*Impl) SrcPort

func (t *Impl) SrcPort() uint16

type UnknownV4ProtocolError added in v1.5.0

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

func (*UnknownV4ProtocolError) Error added in v1.5.0

func (e *UnknownV4ProtocolError) Error() string

type VTuple

type VTuple interface {
	IsUDP() bool
	IsTCP() bool
	IsIP4() bool
	IsIP6() bool

	SrcAddr() netip.Addr
	DstAddr() netip.Addr
	SrcPort() uint16
	DstPort() uint16
}

Jump to

Keyboard shortcuts

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