protocol

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2015 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package vmess contains protocol definition, io lib for VMess.

Index

Constants

View Source
const (
	CmdTCP = byte(0x01)
	CmdUDP = byte(0x02)

	Version = byte(0x01)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type VMessRequest

type VMessRequest struct {
	Version        byte
	UserId         user.ID
	RequestIV      [16]byte
	RequestKey     [16]byte
	ResponseHeader [4]byte
	Command        byte
	Address        v2net.Address
}

VMessRequest implements the request message of VMess protocol. It only contains the header of a request message. The data part will be handled by conection handler directly, in favor of data streaming.

func (*VMessRequest) Destination

func (request *VMessRequest) Destination() v2net.Destination

Destination is the final destination of this request.

func (*VMessRequest) ToBytes

func (request *VMessRequest) ToBytes(idHash user.CounterHash, randomRangeInt64 user.RandomInt64InRange, buffer []byte) ([]byte, error)

ToBytes returns a VMessRequest in the form of byte array.

type VMessRequestReader

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

VMessRequestReader is a parser to read VMessRequest from a byte stream.

func NewVMessRequestReader

func NewVMessRequestReader(vUserSet user.UserSet) *VMessRequestReader

NewVMessRequestReader creates a new VMessRequestReader with a given UserSet

func (*VMessRequestReader) Read

func (r *VMessRequestReader) Read(reader io.Reader) (*VMessRequest, error)

Read reads a VMessRequest from a byte stream.

type VMessResponse

type VMessResponse [4]byte

VMessResponse is the header of a TCP response in VMess format.

func NewVMessResponse

func NewVMessResponse(request *VMessRequest) *VMessResponse

NewVMessResponse creates a VMessResponse from a given VMessRequest.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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