socksaddr

package
v0.0.0-...-bf82029 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadString

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

func WriteString

func WriteString(writer io.Writer, op string, str string) error

Types

type Addr

type Addr interface {
	Family() Family
	Addr() netip.Addr
	Fqdn() string
	String() string
}

func AddrFromFqdn

func AddrFromFqdn(fqdn string) Addr

func AddrFromIP

func AddrFromIP(ip net.IP) Addr

func AddressFromNetAddr

func AddressFromNetAddr(netAddr net.Addr) (addr Addr, port uint16)

type Addr16

type Addr16 [16]byte

func (Addr16) Addr

func (a Addr16) Addr() netip.Addr

func (Addr16) Family

func (a Addr16) Family() Family

func (Addr16) Fqdn

func (a Addr16) Fqdn() string

func (Addr16) String

func (a Addr16) String() string

type Addr4

type Addr4 [4]byte

func (Addr4) Addr

func (a Addr4) Addr() netip.Addr

func (Addr4) Family

func (a Addr4) Family() Family

func (Addr4) Fqdn

func (a Addr4) Fqdn() string

func (Addr4) String

func (a Addr4) String() string

type AddrFqdn

type AddrFqdn string

func (AddrFqdn) Addr

func (f AddrFqdn) Addr() netip.Addr

func (AddrFqdn) Family

func (f AddrFqdn) Family() Family

func (AddrFqdn) Fqdn

func (f AddrFqdn) Fqdn() string

func (AddrFqdn) String

func (f AddrFqdn) String() string

type Family

type Family byte
const (
	AddressFamilyIPv4 Family = iota
	AddressFamilyIPv6
	AddressFamilyFqdn
)

func (Family) IsFqdn

func (af Family) IsFqdn() bool

func (Family) IsIP

func (af Family) IsIP() bool

func (Family) IsIPv4

func (af Family) IsIPv4() bool

func (Family) IsIPv6

func (af Family) IsIPv6() bool

type FamilyParser

type FamilyParser func(byte) byte

type Serializer

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

func NewSerializer

func NewSerializer(options ...SerializerOption) *Serializer

func (*Serializer) ReadAddress

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

func (*Serializer) ReadAddressAndPort

func (s *Serializer) ReadAddressAndPort(reader io.Reader) (addr Addr, port uint16, err error)

func (*Serializer) ReadPort

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

func (*Serializer) WriteAddress

func (s *Serializer) WriteAddress(writer io.Writer, addr Addr) error

func (*Serializer) WriteAddressAndPort

func (s *Serializer) WriteAddressAndPort(writer io.Writer, addr Addr, port uint16) 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

func WithFamilyParser

func WithFamilyParser(fp FamilyParser) SerializerOption

type StringTooLongException

type StringTooLongException struct {
	Op  string
	Len int
}

func (StringTooLongException) Error

func (e StringTooLongException) Error() string

Jump to

Keyboard shortcuts

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