HTTP3
QUIC protocol is a transport layer network protocol that provides security equivalent to TLS/SSL, while also having lower connection and transmission latency. QUIC
is currently mainly used in the HTTP
protocol, which is known as HTTP/3
and is the third official version of the HTTP
protocol.
Hertz-HTTP3 implementation based quic-go, Implementation Link.
For the interface design scheme provided by Hertz to support Hertz HTTP3 in the network transport layer and protocol layer, please refer to Hertz Support QUIC & HTTP/3.
Install
Note: The go version must be greater than or equal to 1.19.
Network Layer and Protocol Layer Registration
Network Layer Registration
Protocol Layer Registration
Config Description
Server
Option | Description |
---|---|
WithTransport | Set the network layer implementation |
WithAltTransport | Set the alternative network layer implementation. The AltTransporter will be used for parallel listening - both in TCP and QUIC |
WithALPN | Set whether to enable ALPN |
WithTLS | Set TLS Config |
WithHostPorts | Set the host and port for starting the service |
Sample Code
Server
Note: The
QUIC
protocol relies on theTLS
protocol, soTLS
configuration needs to be provided.
Client
Hertz-HTTP3 currently does not provide a client implementation, but the TLS
configuration of the server sample code is directly copied to quic-go. Therefore, you can directly use the Client Example Code in quic-go.