fix: Use parsedUrl.Hostname() for TLS SNI

This commit is contained in:
2024-10-23 12:46:03 +03:00
parent 62369d90ae
commit f9b5fd5e7f

View File

@@ -80,8 +80,8 @@ func ConnectAndGetData(url string) ([]byte, error) {
// Perform the TLS handshake
tlsConfig := &tls.Config{
InsecureSkipVerify: true, // Accept all TLS certs, even if insecure.
ServerName: parsedUrl.Host, // SNI
InsecureSkipVerify: true, // Accept all TLS certs, even if insecure.
ServerName: parsedUrl.Hostname(), // SNI should not include port
// MinVersion: tls.VersionTLS12, // Use a minimum TLS version. Warning breaks a lot of sites.
}
tlsConn := tls.Client(conn, tlsConfig)