vtuple

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

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 ErrorUnknownV4Protocol

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

func (*ErrorUnknownV4Protocol) Error

func (e *ErrorUnknownV4Protocol) Error() string

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() net.IP

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() net.IP

func (*Impl) SrcPort

func (t *Impl) SrcPort() uint16

type VTuple

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

	SrcAddr() net.IP
	DstAddr() net.IP
	SrcPort() uint16
	DstPort() uint16
}

Jump to

Keyboard shortcuts

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