core: v2ray.com/core/proxy/vmess/encoding Index | Files

package encoding

import "v2ray.com/core/proxy/vmess/encoding"

Index

Package Files

auth.go client.go commands.go encoding.go errors.generated.go server.go

Constants

const (
    Version = byte(1)
)

Variables

var (
    ErrCommandTypeMismatch = newError("Command type mismatch.")
    ErrUnknownCommand      = newError("Unknown command.")
    ErrCommandTooLarge     = newError("Command too large.")
)

func Authenticate Uses

func Authenticate(b []byte) uint32

Authenticate authenticates a byte array using Fnv hash.

func GenerateChacha20Poly1305Key Uses

func GenerateChacha20Poly1305Key(b []byte) []byte

GenerateChacha20Poly1305Key generates a 32-byte key from a given 16-byte array.

func GenerateChunkNonce Uses

func GenerateChunkNonce(nonce []byte, size uint32) crypto.BytesGenerator

func MarshalCommand Uses

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

func UnmarshalCommand Uses

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

type ClientSession Uses

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

ClientSession stores connection session info for VMess client.

func NewClientSession Uses

func NewClientSession(idHash protocol.IDHash) *ClientSession

NewClientSession creates a new ClientSession.

func (*ClientSession) DecodeResponseBody Uses

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

func (*ClientSession) DecodeResponseHeader Uses

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

func (*ClientSession) EncodeRequestBody Uses

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

func (*ClientSession) EncodeRequestHeader Uses

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

type CommandFactory Uses

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

type CommandSwitchAccountFactory Uses

type CommandSwitchAccountFactory struct {
}

func (*CommandSwitchAccountFactory) Marshal Uses

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

func (*CommandSwitchAccountFactory) Unmarshal Uses

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

type FnvAuthenticator Uses

type FnvAuthenticator struct {
}

FnvAuthenticator is an AEAD based on Fnv hash.

func (*FnvAuthenticator) NonceSize Uses

func (*FnvAuthenticator) NonceSize() int

NonceSize implements AEAD.NonceSize().

func (*FnvAuthenticator) Open Uses

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

Open implements AEAD.Open().

func (*FnvAuthenticator) Overhead Uses

func (*FnvAuthenticator) Overhead() int

Overhead impelements AEAD.Overhead().

func (*FnvAuthenticator) Seal Uses

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

Seal implements AEAD.Seal().

type NoOpAuthenticator Uses

type NoOpAuthenticator struct{}

func (NoOpAuthenticator) NonceSize Uses

func (NoOpAuthenticator) NonceSize() int

func (NoOpAuthenticator) Open Uses

func (NoOpAuthenticator) Open(dst, nonce, ciphertext, additionalData []byte) ([]byte, error)

Open implements AEAD.Open().

func (NoOpAuthenticator) Overhead Uses

func (NoOpAuthenticator) Overhead() int

func (NoOpAuthenticator) Seal Uses

func (NoOpAuthenticator) Seal(dst, nonce, plaintext, additionalData []byte) []byte

Seal implements AEAD.Seal().

type ServerSession Uses

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

ServerSession keeps information for a session in VMess server.

func NewServerSession Uses

func NewServerSession(validator *vmess.TimedUserValidator, sessionHistory *SessionHistory) *ServerSession

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

func (*ServerSession) DecodeRequestBody Uses

func (s *ServerSession) DecodeRequestBody(request *protocol.RequestHeader, reader io.Reader) buf.Reader

DecodeRequestBody returns Reader from which caller can fetch decrypted body.

func (*ServerSession) DecodeRequestHeader Uses

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

DecodeRequestHeader decodes and returns (if successful) a RequestHeader from an input stream.

func (*ServerSession) EncodeResponseBody Uses

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

EncodeResponseBody returns a Writer that auto-encrypt content written by caller.

func (*ServerSession) EncodeResponseHeader Uses

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

EncodeResponseHeader writes encoded response header into the given writer.

type SessionHistory Uses

type SessionHistory struct {
    sync.RWMutex
    // contains filtered or unexported fields
}

SessionHistory keeps track of historical session ids, to prevent replay attacks.

func NewSessionHistory Uses

func NewSessionHistory() *SessionHistory

NewSessionHistory creates a new SessionHistory object.

func (*SessionHistory) Close Uses

func (h *SessionHistory) Close() error

Close implements common.Closable.

type ShakeSizeParser Uses

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

func NewShakeSizeParser Uses

func NewShakeSizeParser(nonce []byte) *ShakeSizeParser

func (*ShakeSizeParser) Decode Uses

func (s *ShakeSizeParser) Decode(b []byte) (uint16, error)

func (*ShakeSizeParser) Encode Uses

func (s *ShakeSizeParser) Encode(size uint16, b []byte) []byte

func (*ShakeSizeParser) MaxPaddingLen Uses

func (s *ShakeSizeParser) MaxPaddingLen() uint16

func (*ShakeSizeParser) NextPaddingLen Uses

func (s *ShakeSizeParser) NextPaddingLen() uint16

func (*ShakeSizeParser) SizeBytes Uses

func (*ShakeSizeParser) SizeBytes() int32

Package encoding imports 22 packages (graph) and is imported by 10 packages. Updated 2019-04-08. Refresh now. Tools for package owners.