Skip to content

VMess / VLESS

[!NOTE] This document is partially generated by AI.

VMess and VLESS are powerful transport protocols developed by the V2Ray project. In yuhaiin, both VMess and VLESS (a simplified version of VMess) are supported as outbound-only protocols.

  • TCP: Supported natively.
  • UDP: Supported via UDP over Stream. All UDP packets are encapsulated within the underlying stream (TCP, WebSocket, etc.).
    • NAT Type: Symmetric NAT. Currently, each UDP association is tied to a single remote target in the VMess implementation.

VMess is a stateful protocol that provides its own encryption layer.

  • id (string): The UUID (User ID) used for authentication.
  • aid (int): AlterID.
    • Details: Modern configurations (V2Ray v4.28.1+) typically set this to 0 to use AEAD authentication. Non-zero values are mostly for legacy compatibility.
  • security (string): The encryption algorithm for the data payload.
    • auto: Recommended. Selects based on the system’s hardware acceleration (AES-GCM or Chacha20-Poly1305).
    • aes-128-gcm, chacha20-poly1305, none.

VLESS is a lightweight, stateless successor to VMess. It does not provide internal encryption and relies on the transport layer (e.g., TLS) for security.

  • uuid (string): The User ID used for authentication.

Both VMess and VLESS are highly flexible and usually require additional layers:

  1. simple: Specifies the server address and port.
  2. tls: (Optional but recommended for VMess, required for VLESS) Adds a security layer.
  3. websocket or grpc: (Optional) Wraps traffic in additional transport protocols.
  4. vmess or vless: The final protocol layer.
{
"name": "VMess-WS-Client",
"protocols": [
{ "simple": { "host": "vm.example.com", "port": 443 } },
{ "tls": { "enable": true, "servernames": ["vm.example.com"] } },
{ "websocket": { "host": "vm.example.com", "path": "/v2" } },
{ "vmess": { "id": "de305d54-75b4-431b-adb2-eb6b9e546014", "aid": 0, "security": "auto" } }
]
}
{
"name": "VLESS-Reality-Client",
"protocols": [
{ "simple": { "host": "vl.example.com", "port": 443 } },
{ "reality": { "server_name": "www.microsoft.com", "public_key": "your-key", "short_id": "your-id" } },
{ "vless": { "uuid": "de305d54-75b4-431b-adb2-eb6b9e546014" } }
]
}

VMess implementation handles the MD5/AEAD handshake and various ciphers. VLESS is simpler, handling only the header and authentication check. Both are located in their respective packages under pkg/net/proxy/.

yuhaiin supports vmess:// (Base64 JSON) and vless:// (URL format) links.