Enable tls1.3 if not explicitly disabled

pull/2141/head
Shelikhoo 2019-04-16 19:31:41 +08:00
parent 20f05b5373
commit fa976b8a1b
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316
2 changed files with 16 additions and 7 deletions

View File

@ -4,7 +4,6 @@ package tls
import (
"crypto/tls"
"os"
"v2ray.com/core/common/buf"
"v2ray.com/core/common/net"
@ -66,9 +65,3 @@ func Server(c net.Conn, config *tls.Config) net.Conn {
tlsConn := tls.Server(c, config)
return &conn{Conn: tlsConn}
}
func init() {
// opt-in TLS 1.3 for Go1.12
// TODO: remove this line when Go1.13 is released.
_ = os.Setenv("GODEBUG", os.Getenv("GODEBUG")+",tls13=1")
}

View File

@ -0,0 +1,16 @@
// +build !confonly
package tls
import (
"os"
"strings"
)
func init() {
// opt-in TLS 1.3 for Go1.12
// TODO: remove this line when Go1.13 is released.
if !strings.Contains(os.Getenv("GODEBUG"), "tls13") {
_ = os.Setenv("GODEBUG", os.Getenv("GODEBUG")+",tls13=1")
}
}