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.
Network Support
Section titled “Network Support”- TCP: Supported (Stream-based).
- UDP: Not supported.
Client Configuration (Outbound)
Section titled “Client Configuration (Outbound)”When used as an outbound transport, the http2 block uses the following field:
Configuration Fields
Section titled “Configuration Fields”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.
Server Configuration (Inbound)
Section titled “Server Configuration (Inbound)”yuhaiin can also act as an HTTP/2 transport server.
Configuration Fields
Section titled “Configuration Fields”- The
http2inbound primarily uses the sameconcurrencysetting to limit incoming streams per connection.
Example Configuration
Section titled “Example Configuration”{ "http2": { "concurrency": 8 }}Developer Details
Section titled “Developer Details”Resource Efficiency
Section titled “Resource Efficiency”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.
Implementation
Section titled “Implementation”Located in pkg/net/proxy/http2. It leverages Go’s x/net/http2 package.