vmess

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2018 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OptChunkStream        byte = 1
	OptReuseTCPConnection byte = 2
	OptMetadataObfuscate  byte = 4
)

Request Options

View Source
const (
	SecTypeUnknown          byte = 0 // don't use in client
	SecTypeLegacy           byte = 1 // don't use in client (aes-128-cfb)
	SecTypeAuto             byte = 2 // don't use in client
	SecTypeAES128GCM        byte = 3
	SecTypeChacha20Poly1305 byte = 4
	SecTypeNone             byte = 5
)

SEC types

View Source
const (
	CmdTCP byte = 1
	CmdUDP byte = 2
)

CMD types

Variables

This section is empty.

Functions

func GetKey

func GetKey(uuid [16]byte) []byte

GetKey returns the key of AES-128-CFB encrypter Key:MD5(UUID + []byte('c48619fe-8f02-49e0-b9e9-edf763e17e21'))

func NewVMessDialer

func NewVMessDialer(s string, dialer proxy.Dialer) (proxy.Dialer, error)

NewVMessDialer returns a vmess proxy dialer.

func ParseAddr

func ParseAddr(s string) (AType, Addr, Port, error)

ParseAddr parses the address in string s. return AType = 0 if error.

func StrToUUID

func StrToUUID(s string) (uuid [16]byte, err error)

StrToUUID converts string to uuid. s fomat: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"

func TimestampHash

func TimestampHash(t time.Time) []byte

TimestampHash returns the iv of AES-128-CFB encrypter IV:MD5(X + X + X + X),X = []byte(timestamp.now) (8 bytes, Big Endian)

Types

type AType

type AType byte

AType is vmess addr type

const (
	ATypeErr    AType = 0
	ATypeIP4    AType = 1
	ATypeDomain AType = 2
	ATypeIP6    AType = 3
)

Atyp

type Addr

type Addr []byte

Addr is vmess addr

type Client

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

Client vmess client

func NewClient

func NewClient(uuidStr string, alterID int) (*Client, error)

NewClient .

func (*Client) NewConn

func (c *Client) NewConn(rc net.Conn, target string) (*Conn, error)

NewConn .

type Conn

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

Conn is a connection to vmess server

func (*Conn) DecodeRespHeader

func (c *Conn) DecodeRespHeader() error

DecodeRespHeader .

func (*Conn) EncodeAuthInfo

func (c *Conn) EncodeAuthInfo() []byte

EncodeAuthInfo returns HMAC("md5", UUID, UTC) result

func (*Conn) EncodeRequest

func (c *Conn) EncodeRequest() ([]byte, error)

EncodeRequest encodes requests to network bytes

func (*Conn) Read

func (c *Conn) Read(b []byte) (n int, err error)

func (*Conn) Write

func (c *Conn) Write(b []byte) (n int, err error)

type Port

type Port uint16

Port is vmess addr port

type User

type User struct {
	UUID   [16]byte
	CmdKey [16]byte
}

User of vmess client

func NewUser

func NewUser(uuid [16]byte) *User

NewUser .

func (*User) GenAlterIDUsers

func (u *User) GenAlterIDUsers(alterID int) []*User

GenAlterIDUsers generates users according to primary user's id and alterID

type VMess

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

VMess .

func NewVMess

func NewVMess(s string, dialer proxy.Dialer) (*VMess, error)

NewVMess returns a vmess proxy.

func (*VMess) Addr

func (s *VMess) Addr() string

Addr returns forwarder's address

func (*VMess) Dial

func (s *VMess) Dial(network, addr string) (net.Conn, error)

Dial connects to the address addr on the network net via the proxy.

func (*VMess) DialUDP

func (s *VMess) DialUDP(network, addr string) (net.PacketConn, net.Addr, error)

DialUDP connects to the given address via the proxy.

func (*VMess) NextDialer

func (s *VMess) NextDialer(dstAddr string) proxy.Dialer

NextDialer returns the next dialer

Jump to

Keyboard shortcuts

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