Documentation
¶
Index ¶
- Constants
- Variables
- func Authenticate(b []byte) uint32
- func MarshalCommand(command interface{}, writer io.Writer) error
- func UnmarshalCommand(cmdId byte, data []byte) (protocol.ResponseCommand, error)
- type ClientSession
- func (this *ClientSession) DecodeResponseBody(reader io.Reader) io.Reader
- func (this *ClientSession) DecodeResponseHeader(reader io.Reader) (*protocol.ResponseHeader, error)
- func (this *ClientSession) EncodeRequestBody(writer io.Writer) io.Writer
- func (this *ClientSession) EncodeRequestHeader(header *protocol.RequestHeader, writer io.Writer)
- type CommandFactory
- type CommandSwitchAccountFactory
- type ServerSession
- func (this *ServerSession) DecodeRequestBody(reader io.Reader) io.Reader
- func (this *ServerSession) DecodeRequestHeader(reader io.Reader) (*protocol.RequestHeader, error)
- func (this *ServerSession) EncodeResponseBody(writer io.Writer) io.Writer
- func (this *ServerSession) EncodeResponseHeader(header *protocol.ResponseHeader, writer io.Writer)
- func (this *ServerSession) Release()
Constants ¶
View Source
const (
Version = byte(1)
AddrTypeIPv4 = byte(0x01)
AddrTypeIPv6 = byte(0x03)
AddrTypeDomain = byte(0x02)
)
Variables ¶
View Source
var (
ErrCommandTypeMismatch = errors.New("Command type mismatch.")
ErrUnknownCommand = errors.New("Unknown command.")
ErrCommandTooLarge = 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 {
}
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)
Click to show internal directories.
Click to hide internal directories.