reject unknown versions in the quic.Config

This commit is contained in:
Marten Seemann
2018-01-05 13:38:27 +07:00
parent cd01b55090
commit 624ac61412
6 changed files with 76 additions and 33 deletions

View File

@@ -4,6 +4,7 @@ import (
"bytes"
"crypto/tls"
"errors"
"fmt"
"net"
"sync"
"time"
@@ -85,9 +86,12 @@ func Listen(conn net.PacketConn, tlsConf *tls.Config, config *Config) (Listener,
}
config = populateServerConfig(config)
// check if any of the supported versions supports TLS
var supportsTLS bool
for _, v := range config.Versions {
if !protocol.IsValidVersion(v) {
return nil, fmt.Errorf("%s is not a valid QUIC version", v)
}
// check if any of the supported versions supports TLS
if v.UsesTLS() {
supportsTLS = true
break