Skip to content

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.

  • TCP: Supported (Intercepted and proxied).
  • UDP: Supported (Intercepted and proxied, primarily via SOCKS5).
    • NAT Type: Full-Cone NAT (SOCKS5 UDP is Full-Cone).

The mixed protocol block allows you to provide a single entry point for various types of clients.

  • user (string): (Optional) The shared username required for both SOCKS5 and HTTP clients.
  • password (string): (Optional) The shared password.

The Mixed inbound must be paired with a tcpudp listener.

{
"name": "Global-Mixed-Inbound",
"enabled": true,
"tcpudp": { "host": "0.0.0.0:1080" },
"mixed": {
"user": "yuhaiin",
"password": "secret-password"
}
}

When a new connection arrives, the Mixed inbound reads the first byte:

  1. If the first byte is 0x05, it is handled as a SOCKS5 handshake.
  2. Otherwise, it attempts to parse the payload as an HTTP request.
  3. If neither protocol is matched, the connection is terminated.

This auto-detection happens only at the very beginning of the connection, adding negligible overhead while significantly simplifying client configuration.