Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议将大陆可访问的Google服务从geosite:geolocation-!cn中移除 #29

Closed
wlnirvana opened this issue Jun 10, 2020 · 8 comments
Closed

Comments

@wlnirvana
Copy link

fonts.googleapis.com等服务在大陆已经解封,可以直接解析到北京的服务器使用。如果使用1.1.1.1之类进行解析,访问速度反而不理想。

而本项目README中提到:

@felixonmars/dnsmasq-china-list/google.china.conf 加入到 geosite:geolocation-!cn 类别中

但dnsmasq-china-list其实是这样解释google.china.conf的:

These domains are resolved to Google China servers when using a Chinese DNS. In most conditions this will yield better page load time for sites using Google's web services, e.g. Google Web Fonts and AdSense.

是不是可以考虑从geosite:geolocation-!cn中移除,加到比如geosite:cn当中去?

Loyalsoldier added a commit that referenced this issue Jun 10, 2020
due to accessibility in China mainland and #29 and #24 and #13
Loyalsoldier added a commit that referenced this issue Jun 10, 2020
due to accessibility in China mainland and #29 and #24 and #13
@Loyalsoldier
Copy link
Owner

新增了 apple-cngoogle-cn 两个类别,使用方式参考 README.md 文档。

@wlnirvana
Copy link
Author

更新了dat文件,貌似仍然无法在DNS中使用。不太确定domains(跟RuleObject中的domains语法应该是一样的)内部是否有优先级的处理。

配置:

  "dns": {
    "servers": [
      {
        "address": "https+local:https://dns.alidns.com/dns-query",
        "domains": [
          "geosite:cn",
          "geosite:apple-cn",
          "geosite:google-cn",
          "fonts.googleapis.com"
        ]
      },
      {
        "address": "https://1.1.1.1/dns-query",
        "domains": [
          "geosite:geolocation-!cn",
          "geosite:speedtest"
        ]
      },
      "223.5.5.5"
    ]
  }

@Loyalsoldier
Copy link
Owner

这是 V2Ray 服务端的配置?

@Loyalsoldier
Copy link
Owner

Loyalsoldier commented Jun 10, 2020

V2Ray 客户端配置的 routing 里使用 "domainStrategy": "AsIs",就不需要对域名规则进行 DNS 解析了。然后把 geosite:apple-cngeosite:google-cn 的规则放在代理规则的上面,优先级就比代理规则要高。

V2Ray 中 DNS 规则的实现逻辑好像比较混乱,具体我也不太清楚。

"routing": {
    "domainStrategy": "AsIs",
    "rules": [
      {
        "type": "field",
        "outboundTag": "Direct",
        "protocol": ["bittorrent"]
      },
      {
        "type": "field",
        "outboundTag": "Dns-Out",
        "inboundTag": [
          "Socks-In",
          "Http-In"
        ],
        "network": "udp",
        "port": 53
      },
      {
        "type": "field",
        "outboundTag": "Reject",
        "domain": [
          "geosite:category-ads-all"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Direct",
        "domain": [
          "geosite:apple-cn",
          "geosite:google-cn"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Proxy",
        "domain": [
          "geosite:geolocation-!cn"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Direct",
        "domain": [
          "geosite:cn"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Direct",
        "ip": [
          "223.5.5.5/32",
          "119.29.29.29/32",
          "180.76.76.76/32",
          "114.114.114.114/32"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Proxy",
        "ip": [
          "1.1.1.1/32",
          "1.0.0.1/32",
          "8.8.8.8/32",
          "8.8.4.4/32"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Direct",
        "ip": [
          "geoip:cn",
          "geoip:private"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Proxy",
        "network": "tcp,udp"
      }
    ]
  }

@wlnirvana
Copy link
Author

是客户端DNS的配置。我除了配有routing之外,还用了类似这个评论里的方法进行DNS解析的分流。

@Loyalsoldier
Copy link
Owner

Loyalsoldier commented Jun 10, 2020

我印象中,一旦在 routing 里使用了 "domainStrategy": "IPIfNonMatch" 后,会优先进行域名规则匹配。由于在 geosite:geolocation-!cn 有 google 和 apple 的域名,如果没有在 geosite:geolocation-!cn 配置的上面显式设置 geosite:apple-cngeosite:google-cn 为直连的话,请求会命中 geosite:geolocation-!cn 走代理的规则。这时候 V2Ray 是不会进行 DNS 解析的,会直接通过 CONNECT 方法往 V2Ray 服务端发送域名,由 V2Ray 服务端进行 DNS 解析。

所以即使你在客户端配置了 DNS,在 routing 中被设置为走代理的域名都不会使用到 DNS 解析。而如果你访问的域名被设置了直连规则,再配合下图这个配置,才会启用 V2Ray 里的 DNS 配置。

image

最后,如果访问的域名不在 geosite.dat 文件中,也没有显式设置任何规则(也就是没有命中任何域名规则),则域名会进行 DNS 解析。

也就是说,要想达到你预期的效果,要这样配置(配置不全,只列出了重要部分,有些 tag 要对应更改):

 "dns": {
    "servers": [
      {
        "address": "https+local:https://dns.alidns.com/dns-query",
        "domains": [
          "geosite:cn",
          "geosite:apple-cn",
          "geosite:google-cn",
          "domain:fonts.googleapis.com"
        ]
      },
      {
        "address": "https://1.1.1.1/dns-query",
        "domains": [
          "geosite:geolocation-!cn",
          "geosite:speedtest"
        ]
      },
      "223.5.5.5"
    ]
  }
"routing": {
    "domainStrategy": "IPIfNonMatch",
    "rules": [
      {
        "type": "field",
        "outboundTag": "Dns-Out",
        "inboundTag": [
          "Socks-In",
          "Http-In"
        ],
        "network": "udp",
        "port": 53
      },
      {
        "type": "field",
        "outboundTag": "Reject",
        "domain": [
          "geosite:category-ads-all"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Direct",
        "domain": [
          "geosite:apple-cn",
          "geosite:google-cn"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Proxy",
        "domain": [
          "geosite:geolocation-!cn"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Direct",
        "domain": [
          "geosite:cn"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Direct",
        "ip": [
          "geoip:cn",
          "geoip:private"
        ]
      },
      {
        "type": "field",
        "outboundTag": "Proxy",
        "network": "tcp,udp"
      }
    ]
  }
"outbounds": [
    {
      "protocol": "freedom",
      "tag": "Direct",
      "settings": {
        "domainStrategy": "UseIPv4"
      }
    }
]

@wlnirvana
Copy link
Author

在routing当中也配了的,还是不行。我觉得可能是v2ray本身有关于优先级的逻辑。

@Loyalsoldier
Copy link
Owner

上游已修复了这个问题:v2fly/v2ray-core#94

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants