Skip to content

HTTP/2

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

HTTP/2 is a major revision of the HTTP network protocol. In yuhaiin, it is used as a transport layer to multiplex multiple proxy connections over a single TCP connection.

  • TCP: Supported (Stream-based).
  • UDP: Not supported.

When used as an outbound transport, the http2 block uses the following field:

  • concurrency (int): The maximum number of simultaneous streams allowed on a single HTTP/2 connection. Increasing this can improve performance for applications that open many concurrent connections.

yuhaiin can also act as an HTTP/2 transport server.

  • The http2 inbound primarily uses the same concurrency setting to limit incoming streams per connection.
{
"http2": {
"concurrency": 8
}
}

Using HTTP/2 as a transport layer is highly efficient as it reuses a single TLS handshake for multiple independent proxy requests, significantly reducing overhead and improving latency for bursty traffic.

Located in pkg/net/proxy/http2. It leverages Go’s x/net/http2 package.