reject a tls.Config without NextProtos for dialing

This commit is contained in:
Marten Seemann
2019-06-02 01:08:11 +08:00
parent 8eeddeb9c0
commit 09111b45f9
2 changed files with 22 additions and 10 deletions

View File

@@ -3,6 +3,7 @@ package quic
import (
"context"
"crypto/tls"
"errors"
"fmt"
"net"
"sync"
@@ -119,6 +120,9 @@ 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")
}
config = populateClientConfig(config, createdPacketConn)
packetHandlers, err := getMultiplexer().AddConn(pconn, config.ConnectionIDLength, config.StatelessResetKey)
if err != nil {