Source file src/vendor/golang.org/x/net/internal/http3/quic.go

     1  // Copyright 2025 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package http3
     6  
     7  import (
     8  	"crypto/tls"
     9  	"slices"
    10  
    11  	"golang.org/x/net/quic"
    12  )
    13  
    14  func newQUICConfig(config *quic.Config, tlsConfig *tls.Config) *quic.Config {
    15  	config = config.Clone()
    16  	if config == nil {
    17  		config = &quic.Config{}
    18  	}
    19  	if !slices.Equal(tlsConfig.NextProtos, []string{"h3"}) {
    20  		tlsConfig = tlsConfig.Clone()
    21  		if tlsConfig == nil {
    22  			tlsConfig = &tls.Config{}
    23  		}
    24  		tlsConfig.NextProtos = []string{"h3"}
    25  	}
    26  	config.TLSConfig = tlsConfig
    27  	return config
    28  }
    29  

View as plain text