mirror of
https://github.com/daeuniverse/dae.git
synced 2025-07-28 05:39:43 +07:00
feat: support independent tcp4, tcp6, udp4, udp6 connectivity check
This commit is contained in:
@ -5,6 +5,8 @@
|
||||
|
||||
package consts
|
||||
|
||||
import "net/netip"
|
||||
|
||||
type DialerSelectionPolicy string
|
||||
|
||||
const (
|
||||
@ -13,3 +15,32 @@ const (
|
||||
DialerSelectionPolicy_MinAverage10Latencies DialerSelectionPolicy = "min_avg10"
|
||||
DialerSelectionPolicy_MinLastLatency DialerSelectionPolicy = "min"
|
||||
)
|
||||
|
||||
const (
|
||||
UdpCheckLookupHost = "connectivitycheck.gstatic.com."
|
||||
)
|
||||
|
||||
type L4ProtoStr string
|
||||
|
||||
const (
|
||||
L4ProtoStr_TCP L4ProtoStr = "tcp"
|
||||
L4ProtoStr_UDP L4ProtoStr = "udp"
|
||||
)
|
||||
|
||||
type IpVersionStr string
|
||||
|
||||
const (
|
||||
IpVersionStr_4 IpVersionStr = "4"
|
||||
IpVersionStr_6 IpVersionStr = "6"
|
||||
)
|
||||
|
||||
func IpVersionFromAddr(addr netip.Addr) IpVersionStr {
|
||||
var ipversion IpVersionStr
|
||||
switch {
|
||||
case addr.Is4() || addr.Is4In6():
|
||||
ipversion = IpVersionStr_4
|
||||
case addr.Is6():
|
||||
ipversion = IpVersionStr_6
|
||||
}
|
||||
return ipversion
|
||||
}
|
||||
|
Reference in New Issue
Block a user