remove the tls.Config from the quic.Config

The tls.Config now is a separate parameter to all Listen and Dial
functions in the quic package.
This commit is contained in:
Marten Seemann
2017-06-30 17:33:35 +02:00
parent 890b801a60
commit a851aaacda
14 changed files with 126 additions and 86 deletions

View File

@@ -28,7 +28,8 @@ type roundTripperOpts struct {
type client struct {
mutex sync.RWMutex
dialAddr func(hostname string, config *quic.Config) (quic.Session, error)
dialAddr func(hostname string, tlsConf *tls.Config, config *quic.Config) (quic.Session, error)
tlsConf *tls.Config
config *quic.Config
opts *roundTripperOpts
@@ -55,8 +56,8 @@ func newClient(tlsConfig *tls.Config, hostname string, opts *roundTripperOpts) *
hostname: authorityAddr("https", hostname),
responses: make(map[protocol.StreamID]chan *http.Response),
encryptionLevel: protocol.EncryptionUnencrypted,
tlsConf: tlsConfig,
config: &quic.Config{
TLSConfig: tlsConfig,
RequestConnectionIDTruncation: true,
},
opts: opts,
@@ -67,7 +68,7 @@ func newClient(tlsConfig *tls.Config, hostname string, opts *roundTripperOpts) *
// dial dials the connection
func (c *client) dial() error {
var err error
c.session, err = c.dialAddr(c.hostname, c.config)
c.session, err = c.dialAddr(c.hostname, c.tlsConf, c.config)
if err != nil {
return err
}