mirror of
https://github.com/daeuniverse/dae.git
synced 2025-07-05 16:00:24 +07:00
fix: ipv4in6 should be converged
This commit is contained in:
@ -10,6 +10,7 @@ import (
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"net/netip"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
@ -366,3 +367,10 @@ func BoolToString(b bool) string {
|
||||
return "0"
|
||||
}
|
||||
}
|
||||
|
||||
func ConvergeIp(addr netip.Addr) netip.Addr {
|
||||
if addr.Is4In6() {
|
||||
addr = netip.AddrFrom4(addr.As4())
|
||||
}
|
||||
return addr
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
"fmt"
|
||||
"github.com/mzz2017/softwind/pool"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/v2rayA/dae/common"
|
||||
"github.com/v2rayA/dae/common/consts"
|
||||
"github.com/v2rayA/dae/component/outbound/dialer"
|
||||
"golang.org/x/net/dns/dnsmessage"
|
||||
@ -287,7 +288,7 @@ func (c *ControlPlane) handlePkt(lConn *net.UDPConn, data []byte, src, pktDst, r
|
||||
// We only validate rush-ans when outbound is direct and pkt does not send to a home device.
|
||||
// Because additional record OPT may not be supported by home router.
|
||||
// So se should trust home devices even if they make rush-answer (or looks like).
|
||||
return outboundIndex == consts.OutboundDirect && !from.Addr().IsPrivate()
|
||||
return outboundIndex == consts.OutboundDirect && !common.ConvergeIp(from.Addr()).IsPrivate()
|
||||
})
|
||||
|
||||
// Dial and send.
|
||||
|
@ -8,8 +8,8 @@ global {
|
||||
|
||||
# Node connectivity check.
|
||||
# Host of URL should have both IPv4 and IPv6 if you have double stack in local.
|
||||
# Considering traffic consumption, it is recommended to choose a site with less response.
|
||||
tcp_check_url: 'http://captive.apple.com'
|
||||
# Considering traffic consumption, it is recommended to choose a site with anycast IP and less response.
|
||||
tcp_check_url: 'http://detectportal.firefox.com/success.txt'
|
||||
|
||||
# This DNS will be used to check UDP connectivity of nodes. And if dns_upstream below contains tcp, it also be used to check
|
||||
# TCP DNS connectivity of nodes.
|
||||
|
Reference in New Issue
Block a user