protocol

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxUDPPacketSize = 1024 * 4
	UDPTimeout       = time.Second * 6
	TCPTimeout       = time.Second * 6
)

Variables

This section is empty.

Functions

func ParsePort

func ParsePort(addr net.Addr) (int, error)

func WriteAddress

func WriteAddress(w io.Writer, request *Request) error

Types

type AddressType

type AddressType byte
const (
	IPv4       AddressType = 1
	DomainName AddressType = 3
	IPv6       AddressType = 4
)

type Command

type Command byte
const (
	Connect   Command = 1
	Bind      Command = 2
	Associate Command = 3
	Mux       Command = 0x7f
)

type ConnSession

type ConnSession interface {
	io.ReadWriteCloser
	HasRequest
}

type HasHash added in v0.0.5

type HasHash interface {
	GetHash() string
}

type HasRequest

type HasRequest interface {
	GetRequest() *Request
}

type NeedAuth added in v0.0.3

type NeedAuth interface {
	SetAuth(auth stat.Authenticator)
}

type NeedConfig

type NeedConfig interface {
	SetConfig(config *conf.GlobalConfig)
}

type NeedMeter added in v0.0.3

type NeedMeter interface {
	SetMeter(meter stat.TrafficMeter)
}

type NeedRespond

type NeedRespond interface {
	Respond(io.Reader) error
}

type PacketReadWriter

type PacketReadWriter interface {
	PacketReader
	PacketWriter
}

type PacketReader

type PacketReader interface {
	ReadPacket() (*Request, []byte, error)
}

type PacketSession

type PacketSession interface {
	PacketReadWriter
	io.Closer
}

type PacketWriter

type PacketWriter interface {
	WritePacket(req *Request, packet []byte) (int, error)
}

type Request

type Request struct {
	DomainName  []byte
	Port        uint16
	IP          net.IP
	AddressType AddressType
	NetworkType string
	Command     Command
	net.Addr
}

func ParseAddress

func ParseAddress(r io.Reader) (*Request, error)

func (*Request) Network

func (r *Request) Network() string

func (*Request) String

func (r *Request) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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