Mixed
[!NOTE] This document is partially generated by AI.
The Mixed inbound is a special “smart” protocol in yuhaiin that automatically distinguishes between HTTP and SOCKS5 requests on the same port. it is exclusively an inbound protocol.
Network Support
Section titled “Network Support”- TCP: Supported (Intercepted and proxied).
- UDP: Supported (Intercepted and proxied, primarily via SOCKS5).
- NAT Type: Full-Cone NAT (SOCKS5 UDP is Full-Cone).
Inbound Configuration
Section titled “Inbound Configuration”The mixed protocol block allows you to provide a single entry point for various types of clients.
Configuration Fields
Section titled “Configuration Fields”user(string): (Optional) The shared username required for both SOCKS5 and HTTP clients.password(string): (Optional) The shared password.
Listener Configuration
Section titled “Listener Configuration”The Mixed inbound must be paired with a tcpudp listener.
Example Configuration
Section titled “Example Configuration”{ "name": "Global-Mixed-Inbound", "enabled": true, "tcpudp": { "host": "0.0.0.0:1080" }, "mixed": { "user": "yuhaiin", "password": "secret-password" }}Developer Details
Section titled “Developer Details”Detection Logic
Section titled “Detection Logic”When a new connection arrives, the Mixed inbound reads the first byte:
- If the first byte is
0x05, it is handled as a SOCKS5 handshake. - Otherwise, it attempts to parse the payload as an HTTP request.
- If neither protocol is matched, the connection is terminated.
Efficiency
Section titled “Efficiency”This auto-detection happens only at the very beginning of the connection, adding negligible overhead while significantly simplifying client configuration.