marsevilspirit opened a new pull request, #2916:
URL: https://github.com/apache/dubbo-go/pull/2916
#### What this PR does / Why we need it
This PR introduces experimental support for **HTTP/3** to the Triple
protocol. By running over **QUIC**, HTTP/3 provides significant performance
advantages over HTTP/2, including:
* **Reduced Head-of-Line Blocking**: Eliminates TCP head-of-line blocking,
improving throughput on lossy networks.
* **Faster Connection Setup**: Combines the transport and cryptographic
handshakes for a 0-RTT or 1-RTT connection setup.
Adding HTTP/3 support keeps the dubbo-go Triple protocol at the forefront of
modern, high-performance web protocols and provides users with a powerful
option for latency-sensitive services.
---
#### Main Changes
* **Dependency**: Introduced `quic-go` as the underlying implementation for
QUIC and HTTP/3.
* **Configuration**: Added new configuration options under
`dubbo.protocols.triple.http3` to enable and control the HTTP/3 listener.
* **TLS Requirement**: Since HTTP/3 mandates the use of TLS 1.3+, the
handling of `tls.Config` has been reinforced. The server will fail to start if
HTTP/3 is enabled without a valid TLS configuration.
---
#### How to use
##### client and server mode
To enable HTTP/3, you must provide a vaild TLS configuration and set the
http3Enable option in your code:
* server side
```go
srv, err := server.NewServer(
server.WithServerProtocol(
protocol.WithPort(20000),
protocol.WithTriple(
triple.Http3Enable(),
),
),
server.WithServerTLSOption(
tls.WithCertFile("../../x509/server2_cert.pem"),
tls.WithKeyFile("../../x509/server2_key.pem"),
tls.WithServerName("dubbogo.test.example.com"),
),
)
```
* client side
```go
cli, err := client.NewClient(
client.WithClientURL("127.0.0.1:20000"),
client.WithClientProtocol(
protocol.WithTriple(
triple.Http3Enable(),
),
),
client.WithClientTLSOption(
tls.WithCACertFile("../../x509/server_ca_cert.pem"),
tls.WithServerName("dubbogo.test.example.com"),
),
)
```
##### yaml file mode
To enable HTTP/3, you must provide a valid TLS configuration and enable the
feature in your configuration file.
* server side
```yaml
# dubbo server yaml configure file
dubbo:
registries:
demoZK:
protocol: zookeeper
timeout: 10s
address: 127.0.0.1:2181
protocols:
tripleProtocol:
name: tri
port: 20000
triple:
http3:
enable: true
provider:
services:
GreetTripleServer:
interface: com.apache.dubbo.sample.Greeter
tls_config:
cert-file: "/path/to/your/cert.pem"
key-file: "/path/to/your/key.pem"
tls-server-name: dubbogo.test.example.com
```
* client side
```yaml
# dubbo client yaml configure file
dubbo:
registries:
demoZK:
protocol: zookeeper
timeout: 3s
address: 127.0.0.1:2181
consumer:
references:
GreetServiceImpl:
protocol: tri
protocol_config:
triple:
http3:
enable: true
interface: com.apache.dubbo.sample.Greeter
registry: demoZK
retries: 3
timeout: 3000
tls_config:
ca-cert-file: "/path/to/yourserver_ca_cert.pem"
tls-server-name: dubbogo.test.example.com
```
**Note**: When enabled, the HTTP/3 server will listen on the same port
number as the HTTP/2 server, but over the UDP protocol.
---
#### Checklist
* [ ] Necessary unit and integration tests have been added.
* [x] Relevant documentation has been updated.
* [x] The feature has been verified locally.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]