English
ours-vlessenc
libs/vlessenc — Xray's VLESS encryption (encryption/decryption): forward secrecy on ML-KEM-768 + X25519.
API
Client::new(text)/with_cipher(text, aes)— parsing the client'sencryptionstring (Nonefornone);connect(io)— the handshake and an encrypted stream.Server::new(text),validate(text)— the server'sdecryptionstring;reload(text)— replace the keys of a running server (througharc-swap);accept(io).Encrypted— the encrypted stream:take_pending,can_splice,poll_raw_*— access to the underlying stream when the protocol (Vision) switches to direct mode.
Internals
Private modules:
config— modes, padding, parsing/generating keys (Config,Mode,Padding).crypto— AES-CTR/AEAD wrappers;kdf— BLAKE3 derive-key with arbitrary context bytes (Xray uses a non-UTF-8 context, while the API of the upstreamblake3crate accepts only UTF-8; the hashing of the key material itself is in the upstream crate).
Who uses it
ours-mod-vless (the vlessenc feature; the binary — the vlessenc feature).
Specifics
#![forbid(unsafe_code)]inlib.rs.- Secrets are zeroed (
zeroize). - Dependencies:
ml-kem,x25519-dalek,blake3,ring,aes,ctr,rand_core+getrandom,base64,arc-swap,tokio,ours-bufpool.
Tests
Unit tests in src/; compatibility with Xray — benchlab (--mode compat, the case vless.tcp.none.vlessenc), see Benchmarks.