vmess

package
v0.6.11 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2018 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OptBasicFormat byte = 0
	OptChunkStream byte = 1
)

Request Options

View Source
const (
	SecurityAES128GCM        byte = 3
	SecurityChacha20Poly1305 byte = 4
	SecurityNone             byte = 5
)

Security types

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

CMD types

Variables

This section is empty.

Functions

func AEADReader added in v0.6.2

func AEADReader(r io.Reader, aead cipher.AEAD, iv []byte) io.Reader

AEADReader returns a aead reader

func AEADWriter added in v0.6.2

func AEADWriter(w io.Writer, aead cipher.AEAD, iv []byte) io.Writer

AEADWriter returns a aead writer

func ChunkedReader added in v0.6.2

func ChunkedReader(r io.Reader) io.Reader

ChunkedReader returns a chunked reader

func ChunkedWriter added in v0.6.2

func ChunkedWriter(w io.Writer) io.Writer

ChunkedWriter returns a chunked writer

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) (Atyp, Addr, Port, error)

ParseAddr parses the address in string s

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 Addr

type Addr []byte

Addr is vmess addr

type Atyp added in v0.6.1

type Atyp byte

Atyp is vmess addr type

const (
	AtypErr    Atyp = 0
	AtypIP4    Atyp = 1
	AtypDomain Atyp = 2
	AtypIP6    Atyp = 3
)

Atyp

type Client

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

Client vmess client

func NewClient

func NewClient(uuidStr, security 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