metadata

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: GPL-2.0 Imports: 11 Imported by: 507

Documentation

Index

Constants

View Source
const (
	MaxSocksaddrLength   = 2 + 255 + 2
	MaxIPSocksaddrLength = 1 + 16 + 2
)

Variables

Functions

func AddrFromIP

func AddrFromIP(ip net.IP) netip.Addr

func AddrFromNetAddr

func AddrFromNetAddr(netAddr net.Addr) netip.Addr

func AddrPortFrom

func AddrPortFrom(ip net.IP, port uint16) netip.AddrPort

func AddrPortFromNet

func AddrPortFromNet(netAddr net.Addr) netip.AddrPort

func IsDomainName

func IsDomainName(domain string) bool

func NetworkFromNetAddr

func NetworkFromNetAddr(network string, addr netip.Addr) string

func ParseAddr

func ParseAddr(address string) netip.Addr

func ReadSockString

func ReadSockString(reader io.Reader) (string, error)

func WriteSocksString

func WriteSocksString(buffer *buf.Buffer, str string) error

Types

type Family

type Family = byte
const (
	AddressFamilyIPv4  Family = 0x01
	AddressFamilyIPv6  Family = 0x04
	AddressFamilyFqdn  Family = 0x03
	AddressFamilyEmpty Family = 0xff
)

type Metadata

type Metadata struct {
	Protocol    string
	Source      Socksaddr
	Destination Socksaddr
}

type Serializer

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

func NewSerializer

func NewSerializer(options ...SerializerOption) *Serializer

func (*Serializer) AddrPortLen

func (s *Serializer) AddrPortLen(destination Socksaddr) int

func (*Serializer) AddressLen

func (s *Serializer) AddressLen(addr Socksaddr) int

func (*Serializer) ReadAddrPort

func (s *Serializer) ReadAddrPort(reader io.Reader) (destination Socksaddr, err error)

func (*Serializer) ReadAddress

func (s *Serializer) ReadAddress(reader io.Reader) (Socksaddr, error)

func (*Serializer) ReadPort

func (s *Serializer) ReadPort(reader io.Reader) (uint16, error)

func (*Serializer) WriteAddrPort

func (s *Serializer) WriteAddrPort(writer io.Writer, destination Socksaddr) error

func (*Serializer) WriteAddress

func (s *Serializer) WriteAddress(buffer *buf.Buffer, addr Socksaddr) error

func (*Serializer) WritePort

func (s *Serializer) WritePort(writer io.Writer, port uint16) error

type SerializerOption

type SerializerOption func(*Serializer)

func AddressFamilyByte

func AddressFamilyByte(b byte, f Family) SerializerOption

func PortThenAddress

func PortThenAddress() SerializerOption

type Socksaddr

type Socksaddr struct {
	Addr netip.Addr
	Port uint16
	Fqdn string
}

func ParseSocksaddr

func ParseSocksaddr(address string) Socksaddr

func ParseSocksaddrHostPort

func ParseSocksaddrHostPort(host string, port uint16) Socksaddr

func ParseSocksaddrHostPortStr

func ParseSocksaddrHostPortStr(host string, portStr string) Socksaddr

func SocksaddrFrom

func SocksaddrFrom(addr netip.Addr, port uint16) Socksaddr

func SocksaddrFromNet

func SocksaddrFromNet(ap net.Addr) Socksaddr

func SocksaddrFromNetIP

func SocksaddrFromNetIP(ap netip.AddrPort) Socksaddr

func (Socksaddr) AddrPort

func (ap Socksaddr) AddrPort() netip.AddrPort

func (Socksaddr) AddrString

func (ap Socksaddr) AddrString() string

func (Socksaddr) CheckBadAddr

func (ap Socksaddr) CheckBadAddr()

func (Socksaddr) IPAddr

func (ap Socksaddr) IPAddr() *net.IPAddr

func (Socksaddr) IsFqdn

func (ap Socksaddr) IsFqdn() bool

func (Socksaddr) IsIP

func (ap Socksaddr) IsIP() bool

func (Socksaddr) IsIPv4

func (ap Socksaddr) IsIPv4() bool

func (Socksaddr) IsIPv6

func (ap Socksaddr) IsIPv6() bool

func (Socksaddr) IsValid

func (ap Socksaddr) IsValid() bool

func (Socksaddr) Network

func (ap Socksaddr) Network() string

func (Socksaddr) String

func (ap Socksaddr) String() string

func (Socksaddr) TCPAddr

func (ap Socksaddr) TCPAddr() *net.TCPAddr

func (Socksaddr) UDPAddr

func (ap Socksaddr) UDPAddr() *net.UDPAddr

func (Socksaddr) Unwrap

func (ap Socksaddr) Unwrap() Socksaddr

Jump to

Keyboard shortcuts

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