vmess

package
v1.2.3-beta.2 Latest Latest
Warning

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

Go to latest
Published: May 16, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package vmess implements vmess client.

from github.com/Dreamacro/clash/tree/master/transport/vmess/

本作不支持alterid!=0 的情况. 即 仅支持 使用 aead 方式 进行认证

标准: https://www.v2fly.org/developer/protocols/vmess.html

aead:

https://github.com/v2fly/v2fly-github-io/issues/20

Index

Constants

View Source
const (
	OptBasicFormat byte = 0 // 不加密传输
	OptChunkStream byte = 1 // 分块传输,每个分块使用如下Security方法加密
)

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
)

v2ray CMD types

View Source
const Name = "vmess"

Variables

This section is empty.

Functions

func AEADReader

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

AEADReader returns a aead reader

func AEADWriter

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

AEADWriter returns a aead writer

func ChunkedReader

func ChunkedReader(r io.Reader) io.Reader

ChunkedReader returns a chunked reader

func ChunkedWriter

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 TimestampHash

func TimestampHash(unixSec int64) []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 Client

type Client struct {
	proxy.Base
	// contains filtered or unexported fields
}

func (*Client) EstablishUDPChannel

func (c *Client) EstablishUDPChannel(underlay net.Conn, firstPayload []byte, target netLayer.Addr) (netLayer.MsgConn, error)

func (*Client) Handshake

func (c *Client) Handshake(underlay net.Conn, firstPayload []byte, target netLayer.Addr) (io.ReadWriteCloser, error)

func (*Client) Name

func (c *Client) Name() string

type ClientConn

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

ClientConn is a connection to vmess server

func (*ClientConn) CloseConnWithRaddr

func (c *ClientConn) CloseConnWithRaddr(_ netLayer.Addr) error

func (*ClientConn) Fullcone

func (c *ClientConn) Fullcone() bool

vmess 标准 是不支持 fullcone的,和vless v0相同

func (*ClientConn) Read

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

func (*ClientConn) ReadMsgFrom

func (c *ClientConn) ReadMsgFrom() (bs []byte, target netLayer.Addr, err error)

func (*ClientConn) Write

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

func (*ClientConn) WriteMsgTo

func (c *ClientConn) WriteMsgTo(b []byte, _ netLayer.Addr) error

type ClientCreator

type ClientCreator struct{}

func (ClientCreator) NewClient

func (ClientCreator) NewClient(dc *proxy.DialConf) (proxy.Client, error)

func (ClientCreator) NewClientFromURL

func (ClientCreator) NewClientFromURL(url *url.URL) (proxy.Client, error)

Jump to

Keyboard shortcuts

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