From 5fe484eff4fe7b18c59ee84c5cdcf01f5e71d56e Mon Sep 17 00:00:00 2001 From: mzz2017 Date: Sat, 27 Nov 2021 20:42:36 +0800 Subject: [PATCH] fix: fakedns cannot work --- service/core/iptables/redirect.go | 6 ++++-- service/core/iptables/tproxy.go | 3 ++- service/core/v2ray/v2rayTmpl.go | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/service/core/iptables/redirect.go b/service/core/iptables/redirect.go index d2d15385..f6375db2 100644 --- a/service/core/iptables/redirect.go +++ b/service/core/iptables/redirect.go @@ -41,7 +41,8 @@ iptables -w 2 -t nat -A V2RAY -d 192.0.0.0/24 -j RETURN iptables -w 2 -t nat -A V2RAY -d 192.0.2.0/24 -j RETURN iptables -w 2 -t nat -A V2RAY -d 192.88.99.0/24 -j RETURN iptables -w 2 -t nat -A V2RAY -d 192.168.0.0/16 -j RETURN -iptables -w 2 -t nat -A V2RAY -d 198.18.0.0/15 -j RETURN +# fakedns +# iptables -w 2 -t nat -A V2RAY -d 198.18.0.0/15 -j RETURN iptables -w 2 -t nat -A V2RAY -d 198.51.100.0/24 -j RETURN iptables -w 2 -t nat -A V2RAY -d 203.0.113.0/24 -j RETURN iptables -w 2 -t nat -A V2RAY -d 224.0.0.0/4 -j RETURN @@ -63,7 +64,8 @@ ip6tables -w 2 -t nat -A V2RAY -d 2001::/32 -j RETURN ip6tables -w 2 -t nat -A V2RAY -d 2001:20::/28 -j RETURN ip6tables -w 2 -t nat -A V2RAY -d 2001:db8::/32 -j RETURN ip6tables -w 2 -t nat -A V2RAY -d 2002::/16 -j RETURN -ip6tables -w 2 -t nat -A V2RAY -d fc00::/7 -j RETURN +# fakedns +# ip6tables -w 2 -t nat -A V2RAY -d fc00::/7 -j RETURN ip6tables -w 2 -t nat -A V2RAY -d fe80::/10 -j RETURN ip6tables -w 2 -t nat -A V2RAY -d ff00::/8 -j RETURN ip6tables -w 2 -t nat -A V2RAY -m mark --mark 0x80/0x80 -j RETURN diff --git a/service/core/iptables/tproxy.go b/service/core/iptables/tproxy.go index f995967b..7c833345 100644 --- a/service/core/iptables/tproxy.go +++ b/service/core/iptables/tproxy.go @@ -86,7 +86,8 @@ iptables -w 2 -t mangle -A TP_RULE -d 192.0.0.0/24 -j RETURN iptables -w 2 -t mangle -A TP_RULE -d 192.0.2.0/24 -j RETURN iptables -w 2 -t mangle -A TP_RULE -d 192.88.99.0/24 -j RETURN iptables -w 2 -t mangle -A TP_RULE -d 192.168.0.0/16 -j RETURN -iptables -w 2 -t mangle -A TP_RULE -d 198.18.0.0/15 -j RETURN +# fakedns +# iptables -w 2 -t mangle -A TP_RULE -d 198.18.0.0/15 -j RETURN iptables -w 2 -t mangle -A TP_RULE -d 198.51.100.0/24 -j RETURN iptables -w 2 -t mangle -A TP_RULE -d 203.0.113.0/24 -j RETURN iptables -w 2 -t mangle -A TP_RULE -d 224.0.0.0/4 -j RETURN diff --git a/service/core/v2ray/v2rayTmpl.go b/service/core/v2ray/v2rayTmpl.go index 46ef2a0e..5689ba19 100644 --- a/service/core/v2ray/v2rayTmpl.go +++ b/service/core/v2ray/v2rayTmpl.go @@ -328,7 +328,7 @@ func (t *Template) setDNS(outbounds []serverInfo, supportUDP map[string]bool) (r } // fakedns - if t.FakeDns != nil { + if specialMode.ShouldUseFakeDns() { ds := coreObj.DnsServer{ Address: "fakedns", Domains: []string{ @@ -967,14 +967,14 @@ func (t *Template) setDualStack() { } } func (t *Template) setInboundFakeDnsDestOverride() { - if t.FakeDns == nil { + if !specialMode.ShouldUseFakeDns() { return } for i := range t.Inbounds { if t.Inbounds[i].Sniffing.Enabled == false { continue } - t.Inbounds[i].Sniffing.DestOverride = append(t.Inbounds[i].Sniffing.DestOverride, "fakedns") + t.Inbounds[i].Sniffing.DestOverride = []string{"fakedns"} } }