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.
Network Support
Section titled “Network Support”- 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.
Outbound Configuration
Section titled “Outbound Configuration”id(string): The UUID (User ID) used for authentication.aid(int): AlterID.- Details: Modern configurations (V2Ray v4.28.1+) typically set this to
0to use AEAD authentication. Non-zero values are mostly for legacy compatibility.
- Details: Modern configurations (V2Ray v4.28.1+) typically set this to
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.
Outbound Configuration
Section titled “Outbound Configuration”uuid(string): The User ID used for authentication.
Transport and Protocol Chain
Section titled “Transport and Protocol Chain”Both VMess and VLESS are highly flexible and usually require additional layers:
simple: Specifies the server address and port.tls: (Optional but recommended for VMess, required for VLESS) Adds a security layer.websocketorgrpc: (Optional) Wraps traffic in additional transport protocols.vmessorvless: The final protocol layer.
Example Configuration
Section titled “Example Configuration”VMess WS+TLS
Section titled “VMess WS+TLS”{ "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" } } ]}VLESS Reality
Section titled “VLESS Reality”{ "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" } } ]}Developer Details
Section titled “Developer Details”Implementation
Section titled “Implementation”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/.
Link Support
Section titled “Link Support”yuhaiin supports vmess:// (Base64 JSON) and vless:// (URL format) links.