From 8bd6f403d0a6535c0588602088a6c2a797edddfe Mon Sep 17 00:00:00 2001 From: Stephanos Komnenos Date: Tue, 12 Dec 2023 02:28:35 +0800 Subject: [PATCH] Fix ALPN settings --- quic.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/quic.go b/quic.go index 69ceba1..6a23b7e 100644 --- a/quic.go +++ b/quic.go @@ -8,6 +8,7 @@ import ( "github.com/sagernet/quic-go" "github.com/sagernet/quic-go/http3" + "github.com/sagernet/sing/common" M "github.com/sagernet/sing/common/metadata" aTLS "github.com/sagernet/sing/common/tls" ) @@ -104,8 +105,8 @@ func ListenEarly(conn net.PacketConn, config aTLS.ServerConfig, quicConfig *quic } func ConfigureHTTP3(config aTLS.ServerConfig) error { - if len(config.NextProtos()) == 0 { - config.SetNextProtos([]string{http3.NextProtoH3}) + if !common.Contains(config.NextProtos(), http3.NextProtoH3) { + config.SetNextProtos(append([]string{http3.NextProtoH3}, config.NextProtos()...)) } if quicTLSConfig, isQUICConfig := config.(ServerConfig); isQUICConfig { quicTLSConfig.ConfigureHTTP3()