release: version 3.1.2

This commit is contained in:
hiddify
2024-09-29 20:11:52 +02:00
parent 2ede480822
commit c5ba3e024e
17 changed files with 145 additions and 42 deletions

25
v2/common/utils.go Normal file
View File

@@ -0,0 +1,25 @@
package common
import (
"net"
"net/netip"
"time"
)
func CanConnectIPv6Addr(remoteAddr netip.AddrPort) bool {
dialer := net.Dialer{
Timeout: 1 * time.Second,
}
conn, err := dialer.Dial("tcp6", remoteAddr.String())
if err != nil {
return false
}
defer conn.Close()
return true
}
func CanConnectIPv6() bool {
return CanConnectIPv6Addr(netip.MustParseAddrPort("[2001:4860:4860::8888]:80"))
}