remove complex checks performed on the tls.Config

This commit is contained in:
Marten Seemann
2019-07-28 23:57:33 +07:00
parent 7a294f6a78
commit 8c4e4a3208
4 changed files with 8 additions and 27 deletions

View File

@@ -89,6 +89,7 @@ func DialAddrContext(
// The same PacketConn can be used for multiple calls to Dial and Listen,
// QUIC connection IDs are used for demultiplexing the different connections.
// The host parameter is used for SNI.
// The tls.Config must define an application protocol (using NextProtos).
func Dial(
pconn net.PacketConn,
remoteAddr net.Addr,
@@ -121,8 +122,8 @@ func dialContext(
config *Config,
createdPacketConn bool,
) (Session, error) {
if tlsConf == nil || len(tlsConf.NextProtos) == 0 {
return nil, errors.New("quic: NextProtos not set in tls.Config")
if tlsConf == nil {
return nil, errors.New("quic: tls.Config not set")
}
config = populateClientConfig(config, createdPacketConn)
packetHandlers, err := getMultiplexer().AddConn(pconn, config.ConnectionIDLength, config.StatelessResetKey)