protocol

package
v0.0.0-...-d537834 Latest Latest
Warning

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

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

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func ParseAddress

func ParseAddress(conn io.Reader, network string) (*common.Address, error)

func ParsePort

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

func WriteAddress

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

Types

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
}

type HasHash

type HasHash interface {
	GetHash() string
}

type NeedAuth

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

type NeedConfig

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

type NeedMeter

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

type NeedRespond

type NeedRespond interface {
	Respond() error
}

type PacketReadWriter

type PacketReadWriter interface {
	PacketReader
	PacketWriter
}

type PacketReader

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

type PacketSession

type PacketSession interface {
	PacketReadWriter
	io.Closer
}

type PacketWriter

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

type Request

type Request struct {
	net.Addr

	*common.Address
	Command Command
}

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