This commit is contained in:
ccreater 2022-05-08 02:19:41 +08:00
parent 6f15f835f0
commit 5c112e0ca8

View File

@ -218,6 +218,9 @@ func GetProtocol(host string, Timeout int64) (protocol string) {
} }
socksconn, err := common.WrapperTcpWithTimeout("tcp", host, time.Duration(Timeout) * time.Second) socksconn, err := common.WrapperTcpWithTimeout("tcp", host, time.Duration(Timeout) * time.Second)
if err != nil {
return
}
conn := tls.Client(socksconn, &tls.Config{InsecureSkipVerify: true}) conn := tls.Client(socksconn, &tls.Config{InsecureSkipVerify: true})
defer func() { defer func() {
if conn != nil { if conn != nil {
@ -229,7 +232,6 @@ func GetProtocol(host string, Timeout int64) (protocol string) {
conn.Close() conn.Close()
} }
}() }()
if err == nil || strings.Contains(err.Error(), "handshake failure") { if err == nil || strings.Contains(err.Error(), "handshake failure") {
protocol = "https" protocol = "https"
} }