use tls.Config.ServerName for the passing the hostname around

This commit is contained in:
Marten Seemann
2018-10-02 14:47:18 -07:00
parent 91b0f15046
commit c1f55ba910
6 changed files with 17 additions and 38 deletions

View File

@@ -69,10 +69,9 @@ var (
// NewCryptoSetupClient creates a new CryptoSetup instance for a client
func NewCryptoSetupClient(
cryptoStream io.ReadWriter,
hostname string,
connID protocol.ConnectionID,
version protocol.VersionNumber,
tlsConfig *tls.Config,
tlsConf *tls.Config,
params *TransportParameters,
paramsChan chan<- TransportParameters,
handshakeEvent chan<- struct{},
@@ -87,10 +86,10 @@ func NewCryptoSetupClient(
divNonceChan := make(chan struct{})
cs := &cryptoSetupClient{
cryptoStream: cryptoStream,
hostname: hostname,
hostname: tlsConf.ServerName,
connID: connID,
version: version,
certManager: crypto.NewCertManager(tlsConfig),
certManager: crypto.NewCertManager(tlsConf),
params: params,
keyDerivation: crypto.DeriveQuicCryptoAESKeys,
nullAEAD: nullAEAD,

View File

@@ -2,6 +2,7 @@ package handshake
import (
"bytes"
"crypto/tls"
"crypto/x509"
"encoding/binary"
"errors"
@@ -121,10 +122,9 @@ var _ = Describe("Client Crypto Setup", func() {
handshakeEvent = make(chan struct{}, 2)
csInt, err := NewCryptoSetupClient(
stream,
"hostname",
protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7, 8},
version,
nil,
&tls.Config{ServerName: "hostname"},
&TransportParameters{IdleTimeout: protocol.DefaultIdleTimeout},
paramsChan,
handshakeEvent,