raw

package
v1.13.1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version = byte(1)

	AddrTypeIPv4   = byte(0x01)
	AddrTypeIPv6   = byte(0x03)
	AddrTypeDomain = byte(0x02)
)

Variables

View Source
var (
	ErrorCommandTypeMismatch = errors.New("Command type mismatch.")
	ErrorUnknownCommand      = errors.New("Unknown command.")
	ErrorCommandTooLarge     = errors.New("Command too large.")
)

Functions

func Authenticate

func Authenticate(b []byte) uint32

func MarshalCommand

func MarshalCommand(command interface{}, writer io.Writer) error

func UnmarshalCommand

func UnmarshalCommand(cmdId byte, data []byte) (protocol.ResponseCommand, error)

Types

type ClientSession

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

func NewClientSession

func NewClientSession(idHash protocol.IDHash) *ClientSession

func (*ClientSession) DecodeResponseBody

func (this *ClientSession) DecodeResponseBody(reader io.Reader) io.Reader

func (*ClientSession) DecodeResponseHeader

func (this *ClientSession) DecodeResponseHeader(reader io.Reader) (*protocol.ResponseHeader, error)

func (*ClientSession) EncodeRequestBody

func (this *ClientSession) EncodeRequestBody(writer io.Writer) io.Writer

func (*ClientSession) EncodeRequestHeader

func (this *ClientSession) EncodeRequestHeader(header *protocol.RequestHeader, writer io.Writer)

type CommandFactory

type CommandFactory interface {
	Marshal(command interface{}, writer io.Writer) error
	Unmarshal(data []byte) (interface{}, error)
}

type CommandSwitchAccountFactory

type CommandSwitchAccountFactory struct {
}

func (*CommandSwitchAccountFactory) Marshal

func (this *CommandSwitchAccountFactory) Marshal(command interface{}, writer io.Writer) error

func (*CommandSwitchAccountFactory) Unmarshal

func (this *CommandSwitchAccountFactory) Unmarshal(data []byte) (interface{}, error)

type ServerSession

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

func NewServerSession

func NewServerSession(validator protocol.UserValidator) *ServerSession

NewServerSession creates a new ServerSession, using the given UserValidator. The ServerSession instance doesn't take ownership of the validator.

func (*ServerSession) DecodeRequestBody

func (this *ServerSession) DecodeRequestBody(reader io.Reader) io.Reader

func (*ServerSession) DecodeRequestHeader

func (this *ServerSession) DecodeRequestHeader(reader io.Reader) (*protocol.RequestHeader, error)

func (*ServerSession) EncodeResponseBody

func (this *ServerSession) EncodeResponseBody(writer io.Writer) io.Writer

func (*ServerSession) EncodeResponseHeader

func (this *ServerSession) EncodeResponseHeader(header *protocol.ResponseHeader, writer io.Writer)

func (*ServerSession) Release added in v1.12.1

func (this *ServerSession) Release()

Release implements common.Releaseable.

Jump to

Keyboard shortcuts

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