mirror of
https://github.com/fumiama/terasu.git
synced 2026-06-05 01:00:23 +08:00
feat: limit tls minversion to 1.2
This commit is contained in:
@@ -179,7 +179,10 @@ func (ds *DNSList) DialContext(ctx context.Context, dialer *net.Dialer, firstFra
|
||||
}
|
||||
continue
|
||||
}
|
||||
tlsConn = tls.Client(conn, &tls.Config{ServerName: host})
|
||||
tlsConn = tls.Client(conn, &tls.Config{
|
||||
ServerName: host,
|
||||
MinVersion: tls.VersionTLS12,
|
||||
})
|
||||
if firstFragmentLen > 0 {
|
||||
err = terasu.Use(tlsConn).HandshakeContext(ctx, firstFragmentLen)
|
||||
} else {
|
||||
|
||||
@@ -114,7 +114,10 @@ func (ds *DNSList) test() {
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
tlsConn := tls.Client(conn, &tls.Config{ServerName: host})
|
||||
tlsConn := tls.Client(conn, &tls.Config{
|
||||
ServerName: host,
|
||||
MinVersion: tls.VersionTLS12,
|
||||
})
|
||||
err = terasu.Use(tlsConn).Handshake(4)
|
||||
_ = tlsConn.Close()
|
||||
if err == nil {
|
||||
|
||||
@@ -60,6 +60,7 @@ var DefaultClient = http.Client{
|
||||
}
|
||||
tlsConn = tls.Client(conn, &tls.Config{
|
||||
ServerName: host,
|
||||
MinVersion: tls.VersionTLS12,
|
||||
})
|
||||
if terasu.DefaultFirstFragmentLen > 0 {
|
||||
err = terasu.Use(tlsConn).HandshakeContext(ctx, terasu.DefaultFirstFragmentLen)
|
||||
@@ -77,6 +78,7 @@ var DefaultClient = http.Client{
|
||||
}
|
||||
tlsConn = tls.Client(conn, &tls.Config{
|
||||
ServerName: host,
|
||||
MinVersion: tls.VersionTLS12,
|
||||
})
|
||||
err = tlsConn.HandshakeContext(ctx)
|
||||
if err == nil {
|
||||
|
||||
@@ -19,6 +19,7 @@ func TestHTTPDialTLS13(t *testing.T) {
|
||||
t.Log("net.Dial succeeded")
|
||||
tlsConn := tls.Client(conn, &tls.Config{
|
||||
ServerName: "huggingface.co",
|
||||
MinVersion: tls.VersionTLS12,
|
||||
InsecureSkipVerify: true,
|
||||
})
|
||||
err = Use(tlsConn).Handshake(4)
|
||||
@@ -57,6 +58,7 @@ func TestHTTPDialTLS12(t *testing.T) {
|
||||
tlsConn := tls.Client(conn, &tls.Config{
|
||||
ServerName: "huggingface.co",
|
||||
InsecureSkipVerify: true,
|
||||
MinVersion: tls.VersionTLS12,
|
||||
MaxVersion: tls.VersionTLS12,
|
||||
})
|
||||
err = Use(tlsConn).Handshake(4)
|
||||
|
||||
Reference in New Issue
Block a user