mirror of
https://github.com/xiaoqidun/probe.git
synced 2026-01-29 04:58:46 +08:00
@@ -27,7 +27,7 @@ probe -ip 6
|
|||||||
probe -s5 127.0.0.1:54321
|
probe -s5 127.0.0.1:54321
|
||||||
|
|
||||||
# 使用自定义服务器(STUN协议)
|
# 使用自定义服务器(STUN协议)
|
||||||
probe -s1 stun.miwifi.com:3478
|
probe -s1 stun.voipia.net:3478
|
||||||
```
|
```
|
||||||
|
|
||||||
# 授权协议
|
# 授权协议
|
||||||
|
|||||||
+16
-2
@@ -256,11 +256,25 @@ func DetectNAT(conn net.PacketConn, primarySTUN, secondarySTUN, network string,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
respF1, _, _ := performTest(conn, primarySTUN, network, timeout, true, true)
|
respF1, addrF1, _ := performTest(conn, primarySTUN, network, timeout, true, true)
|
||||||
|
if respF1 != nil {
|
||||||
|
if dst, err := resolveAddr(conn, primarySTUN, network); err == nil {
|
||||||
|
if sAddr, ok := dst.(*net.UDPAddr); ok && addrF1 != nil && sAddr.IP.Equal(addrF1.IP) {
|
||||||
|
respF1 = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if respF1 != nil {
|
if respF1 != nil {
|
||||||
res.Filtering = FilteringEndpointIndependent
|
res.Filtering = FilteringEndpointIndependent
|
||||||
} else {
|
} else {
|
||||||
respF2, _, _ := performTest(conn, primarySTUN, network, timeout, false, true)
|
respF2, addrF2, _ := performTest(conn, primarySTUN, network, timeout, false, true)
|
||||||
|
if respF2 != nil {
|
||||||
|
if dst, err := resolveAddr(conn, primarySTUN, network); err == nil {
|
||||||
|
if sAddr, ok := dst.(*net.UDPAddr); ok && addrF2 != nil && sAddr.Port == addrF2.Port {
|
||||||
|
respF2 = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if respF2 != nil {
|
if respF2 != nil {
|
||||||
res.Filtering = FilteringAddressDependent
|
res.Filtering = FilteringAddressDependent
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user