fix(quic): preserve user-configured ALPN instead of hardcoding NextProtos
The QUIC listener and the QUIC/ICMP dialers unconditionally set tlsCfg.NextProtos = ["h3", "quic/v1"], discarding any user-specified ALPN values from TLS options (via tls.options.alpn in config). Clone the TLS config and only apply the default NextProtos when none are already configured, matching the existing pattern in the MASQUE HTTP/3 dialer. This enables non-HTTP/3 QUIC use cases like SMB-over-QUIC which requires ALPN "smb". Fixes go-gost/gost#872
This commit is contained in:
@@ -110,7 +110,10 @@ func (l *quicListener) Init(md md.Metadata) (err error) {
|
||||
}
|
||||
|
||||
tlsCfg := l.options.TLSConfig
|
||||
tlsCfg.NextProtos = []string{"h3", "quic/v1"}
|
||||
tlsCfg = tlsCfg.Clone()
|
||||
if len(tlsCfg.NextProtos) == 0 {
|
||||
tlsCfg.NextProtos = []string{"h3", "quic/v1"}
|
||||
}
|
||||
|
||||
ln, err := quic.ListenEarly(conn, tlsCfg, config)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user