encoding

package
v2.10.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2016 License: MIT Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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 GenerateChacha20Poly1305Key

func GenerateChacha20Poly1305Key(b []byte) []byte

func MarshalCommand

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

func UnmarshalCommand

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

Types

type ChunkNonceGenerator

type ChunkNonceGenerator struct {
	Nonce []byte
	Size  int
	// contains filtered or unexported fields
}

func (*ChunkNonceGenerator) Next

func (v *ChunkNonceGenerator) Next() []byte

type ClientSession

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

func NewClientSession

func NewClientSession(idHash protocol.IDHash) *ClientSession

func (*ClientSession) DecodeResponseBody

func (v *ClientSession) DecodeResponseBody(request *protocol.RequestHeader, reader io.Reader) buf.Reader

func (*ClientSession) DecodeResponseHeader

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

func (*ClientSession) EncodeRequestBody

func (v *ClientSession) EncodeRequestBody(request *protocol.RequestHeader, writer io.Writer) buf.Writer

func (*ClientSession) EncodeRequestHeader

func (v *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 (v *CommandSwitchAccountFactory) Marshal(command interface{}, writer io.Writer) error

func (*CommandSwitchAccountFactory) Unmarshal

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

type FnvAuthenticator

type FnvAuthenticator struct {
}

func (*FnvAuthenticator) NonceSize

func (v *FnvAuthenticator) NonceSize() int

func (*FnvAuthenticator) Open

func (v *FnvAuthenticator) Open(dst, nonce, ciphertext, additionalData []byte) ([]byte, error)

func (*FnvAuthenticator) Overhead

func (v *FnvAuthenticator) Overhead() int

func (*FnvAuthenticator) Seal

func (v *FnvAuthenticator) Seal(dst, nonce, plaintext, additionalData []byte) []byte

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 (v *ServerSession) DecodeRequestBody(request *protocol.RequestHeader, reader io.Reader) buf.Reader

func (*ServerSession) DecodeRequestHeader

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

func (*ServerSession) EncodeResponseBody

func (v *ServerSession) EncodeResponseBody(request *protocol.RequestHeader, writer io.Writer) buf.Writer

func (*ServerSession) EncodeResponseHeader

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

func (*ServerSession) Release

func (v *ServerSession) Release()

Release implements common.Releaseable.

Jump to

Keyboard shortcuts

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