Documentation ¶
Index ¶
- Constants
- func AEADReader(r io.Reader, aead cipher.AEAD, iv []byte) io.ReadCloser
- func AEADWriter(w io.Writer, aead cipher.AEAD, iv []byte) writer
- func ChunkedReader(r io.Reader) io.ReadCloser
- func ChunkedWriter(w io.Writer) writer
- func CreateAuthID(cmdKey []byte, time int64) [16]byte
- func DecodeResponseHeader(responseBodyKey, responseBodyIV []byte, reader net.Conn) ([]byte, error)
- func GetKey(uuid [16]byte) []byte
- func KDF(key []byte, path ...string) []byte
- func KDF16(key []byte, path ...string) []byte
- func NewCipherFromKey(cmdKey []byte) cipher.Block
- func OpenVMessAEADHeader(key [16]byte, authid [16]byte, data io.Reader) ([]byte, bool, int, error)
- func ParseAddr(s string) (Atyp, Addr, Port, error)
- func SealVMessAEADHeader(key [16]byte, data []byte) []byte
- func StrToUUID(s string) (uuid [16]byte, err error)
- func TimestampHash(t time.Time) []byte
- type Addr
- type Atyp
- type Client
- type Conn
- type Port
- type User
Constants ¶
const ( OptBasicFormat byte = 0 OptChunkStream byte = 1 )
Request Options
const ( SecurityAES128GCM byte = 3 SecurityChacha20Poly1305 byte = 4 SecurityNone byte = 5 )
Security types
const ( CmdTCP byte = 1 CmdUDP byte = 2 )
CMD types
const ( KDFSaltConstAuthIDEncryptionKey = "AES Auth ID Encryption" KDFSaltConstAEADRespHeaderLenKey = "AEAD Resp Header Len Key" KDFSaltConstAEADRespHeaderLenIV = "AEAD Resp Header Len IV" KDFSaltConstAEADRespHeaderPayloadKey = "AEAD Resp Header Key" KDFSaltConstAEADRespHeaderPayloadIV = "AEAD Resp Header IV" KDFSaltConstVMessAEADKDF = "VMess AEAD KDF" KDFSaltConstVMessHeaderPayloadAEADKey = "VMess Header AEAD Key" KDFSaltConstVMessHeaderPayloadAEADIV = "VMess Header AEAD Nonce" KDFSaltConstVMessHeaderPayloadLengthAEADKey = "VMess Header AEAD Key_Length" KDFSaltConstVMessHeaderPayloadLengthAEADIV = "VMess Header AEAD Nonce_Length" )
copy from https://github.com/v2fly/v2ray-core/tree/054e6679830885c94cc37d27ab2aa96b5b37e019/proxy/vmess/aead
Variables ¶
This section is empty.
Functions ¶
func AEADReader ¶
AEADReader returns a aead reader
func AEADWriter ¶
AEADWriter returns a aead writer
func ChunkedReader ¶
func ChunkedReader(r io.Reader) io.ReadCloser
ChunkedReader returns a chunked reader
func CreateAuthID ¶
func DecodeResponseHeader ¶
func GetKey ¶
GetKey returns the key of AES-128-CFB encrypter Key:MD5(UUID + []byte('c48619fe-8f02-49e0-b9e9-edf763e17e21'))
func NewCipherFromKey ¶
func OpenVMessAEADHeader ¶
func SealVMessAEADHeader ¶
func TimestampHash ¶
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 {
// contains filtered or unexported fields
}
Client vmess client
func (*Client) NewPacketConn ¶
type Conn ¶
Conn is a connection to vmess server
func (*Conn) EncodeAuthInfo ¶
EncodeAuthInfo returns HMAC("md5", UUID, UTC) result
func (*Conn) EncodeRequest ¶
EncodeRequest encodes requests to network bytes
type User ¶
User of vmess client
func (*User) GenAlterIDUsers ¶
GenAlterIDUsers generates users according to primary user's id and alterID