set the correct HTTP/3 ALPN for QUIC v2

This commit is contained in:
Marten Seemann
2022-05-23 19:38:02 +02:00
parent b2deeceafb
commit c5ee49662d
2 changed files with 14 additions and 16 deletions

View File

@@ -44,7 +44,7 @@ const (
)
func versionToALPN(v protocol.VersionNumber) string {
if v == protocol.Version1 {
if v == protocol.Version1 || v == protocol.Version2 {
return nextProtoH3
}
if v == protocol.VersionTLS || v == protocol.VersionDraft29 {
@@ -63,11 +63,9 @@ func ConfigureTLSConfig(tlsConf *tls.Config) *tls.Config {
return &tls.Config{
GetConfigForClient: func(ch *tls.ClientHelloInfo) (*tls.Config, error) {
// determine the ALPN from the QUIC version used
proto := nextProtoH3Draft29
proto := nextProtoH3
if qconn, ok := ch.Conn.(handshake.ConnWithVersion); ok {
if qconn.GetQUICVersion() == protocol.Version1 {
proto = nextProtoH3
}
proto = versionToALPN(qconn.GetQUICVersion())
}
config := tlsConf
if tlsConf.GetConfigForClient != nil {