Giter Club home page Giter Club logo

mosdns-cn's People

Contributors

alotofblahaj avatar imaegoo avatar irinesistiana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mosdns-cn's Issues

Cache mechanism is not working

Command line:

mosdns-cn --cache=10000 --lazy-cache-ttl=1000 --min-ttl=3600 --max-ttl=7200 --server=127.0.0.1:1053 --upstream=114.114.114.114:53

When I dig two times in any domain, the response time is the same:

user@localhost:~$ time dig @127.0.0.1 -p 1053 g.co

; <<>> DiG 9.18.7-1-Debian <<>> @127.0.0.1 -p 1053 g.co
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56208
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;g.co.				IN	A

;; ANSWER SECTION:
g.co.			3600	IN	A	142.250.178.142

;; Query time: 300 msec
;; SERVER: 127.0.0.1#1053(127.0.0.1) (UDP)
;; WHEN: Sun Dec 18 23:54:47 EST 2022
;; MSG SIZE  rcvd: 53


real	0m0.320s
user	0m0.004s
sys	0m0.006s
user@localhost:~$ time dig @127.0.0.1 -p 1053 g.co

; <<>> DiG 9.18.7-1-Debian <<>> @127.0.0.1 -p 1053 g.co
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52969
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;g.co.				IN	A

;; ANSWER SECTION:
g.co.			3600	IN	A	142.250.178.142

;; Query time: 300 msec
;; SERVER: 127.0.0.1#1053(127.0.0.1) (UDP)
;; WHEN: Sun Dec 18 23:54:48 EST 2022
;; MSG SIZE  rcvd: 53


real	0m0.319s
user	0m0.010s
sys	0m0.000s

When using another DNS forwarder the second query is got from the app cache:

user@localhost:~$ time dig @127.0.0.1 -p 1053 g.co

; <<>> DiG 9.18.7-1-Debian <<>> @127.0.0.1 -p 1053 g.co
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9464
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;g.co.				IN	A

;; ANSWER SECTION:
g.co.			118	IN	A	142.250.178.142

;; Query time: 0 msec
;; SERVER: 127.0.0.1#1053(127.0.0.1) (UDP)
;; WHEN: Sun Dec 18 23:56:36 EST 2022
;; MSG SIZE  rcvd: 49


real	0m0.021s
user	0m0.004s
sys	0m0.006s

Something missing in my config?

请问支持 freebsd 吗?

我想在 OPNsense 上实现只能dns分流,该项目基于 golang 语言,请问是否有计划支持在 freebsd 上构建和运行?

匹配顺序远程优先 bug?

运行命令如下 :
./mosdns-cn -s :7053 -c 1024 --local-upstream 127.0.0.1 --local-domain 'geosite.dat:cn' --local-domain 'geosite.dat:apple-cn' --local-domain 'geosite.dat:google-cn' --local-ip 'geoip.dat:cn' --remote-upstream https://8.8.8.8/dns-query --remote-domain 'geosite.dat:geolocation-!cn' -v

结果如下:
debug mosdns-cn/handler.go:90 [tools.l.google.com. IN A 38689 1] query is remote domain

geosite.dat:cn 和 geosite.dat:google-cn 里面都是包含域名 tools.l.google.com 的,为什么还会使用远程解析呢?难道远程优先?

1.3.0 载入 geosite.dat 出错

fatal mosdns-cn/main.go:251 failed to init entry, failed to load local domain file, failed to load entry /root/cfg/geosite.dat:cn: unsupported match type [/root/cfg/geosite.dat]

返回 1.2.3 正常

请问为什么 --service 可以install done,但无法start?另外 geosite.dat:geolocation-!cn 必须用单引号,如果用双引号就提示 cn event not found。

./mosdns-cn --service install -s :5353 -c 512 --blacklist-domain "geosite.dat:category-ads-all" --local-upstream https://223.5.5.5/dns-query --local-domain "geosite.dat:cn" --local-ip "geoip-cn.dat:cn" --remote-upstream 127.0.0.0:7913 --remote-domain 'geosite.dat:geolocation-!cn'

2021-12-15T04:20:22.143Z info mosdns-cn/main.go:164 install: done

./mosdns-cn --service start

2021-12-15T04:20:30.861Z fatal mosdns-cn/main.go:162 start: "service" failed: exec: "service": executable file not found in $PATH

本项目跟mosdns的关系如何

当mosdns有更新时,本项目会跟随更新么?
如果不是的话,是不是直接使用mosdns+wiki里的配置文件会更好?

多个参数无效

如需同时使用多个参数,在地址后加 ? 然后参数之间用 & 分隔
e.g. tls://dns.google?netaddr=8.8.8.8:853&keepalive=10&socks5=127.0.0.1:1080

请问会并发请求所有上游

远程上游服务器之间是用逗号分隔吧,那写了几个服务器,我看debug每个服务器都返回,那是以最快返回的IP地址为准吗?

v1.1 remotedns不生效

同样的规则,1.0.1正常,
1.1 本应该走remote解析的走local解析
mosdns-cn-linux-amd64
用的参数
./mosdns-cn -s :53 --hosts hosts.txt --local-domain local.txt --remote-domain remote.txt --blacklist-domain blocklist.txt --local-upstream https://223.5.5.5/dns-query?netaddr=223.5.5.5:443 --local-upstream https://doh.pub/dns-query?netaddr=162.14.21.56:443 --local-domain geosite.dat:cn --local-ip geoip.dat:cn --remote-upstream https:///?netaddr=**: --remote-domain geosite.dat:geolocation-!cn

failed to init entry, missing local upstream

开发者你好,我运行时遇到了如下问题,不知道该如何解决,能帮忙看下吗?
万分感谢!!!

运行时错误代码如下:
2022-08-30T13:21:41.309+0800 info mosdns-cn/main.go:246 mosdns-cn ver: 1.4.0
2022-08-30T13:21:41.310+0800 info mosdns-cn/main.go:247 arch: amd64, os: linux, go: go1.18.2
2022-08-30T13:21:41.311+0800 fatal mosdns-cn/main.go:251 failed to init entry, missing local upstream

my-config.yaml文件如下:
server_addr: ":53"
cache_size: 5120
lazy_cache_ttl: 86400
lazy_cache_reply_ttl: 30
redis_cache: ""
min_ttl: 0
max_ttl: 0
hosts: []
blacklist_domain:

国内的域名为什么需要等待国外组的返回?是BUG还是原本的设计逻辑就是这样?

实测如下:
配置了国外组2个服务器8.8.8.8,8.8.4.4,国内组2个服务器114.114.114.114,119.29.29.29,禁用缓存,国内组加上chnroute列表,版本V1.2.3,上级路由挂上美国VPN,按目的地分流国外IP自动走VPN。
国内组添加1个域名:qq.com
国外组添加1个域名:google.com
测试qq.com和google.com都正常,各组内的2个服务器是并行请求,在上级路由封掉其中1个也都能正常反回,即是并行请求,最快反回的立即采用。

但如果测试的是baidu.com问题就来了:

  1. 延时变大,请求延时是VPN 延时200+MS
  2. 在上级路由禁掉国外的2组服务器后DNS解释失败了

这情况不是可以直接采用国内组反回的结果吗???
国内域名等待国外组反回会变得很慢,有时候VPN断了直接就解释不出来了。。。

能否支持过滤本地PTR查询?

能否支持过滤本地PTR查询,内网的PTR查询递归出去之后查询不到结果会在log中告警。
openwrt中的dnsmasq可以有类似的选项“不转发本地网络的反向查询”默认开启的。

强制结束进程后无法启动

我在尝试和测试各样的配置,然后发现了个小问题。

配置文件:
server_addr: ":53"
cache_size: 9999
insecure: false
log_file: "/var/log/mosdns-cn"
local_upstream: ["223.5.5.5", "114.114.114.114"]
remote_upstream: ["https://8.8.8.8/dns-query"]
working_dir: "/etc/mosdns-cn/"

错误log:
2022-08-06T17:41:24.851+0800 info mosdns-cn/main.go:246 mosdns-cn ver: 1.4.0
2022-08-06T17:41:24.851+0800 info mosdns-cn/main.go:247 arch: amd64, os: linux, go: go1.18.2
2022-08-06T17:41:24.851+0800 fatal mosdns-cn/main.go:251 failed to init entry, unsupported diversion mode
2022-08-06T17:41:47.168+0800 info mosdns-cn/main.go:246 mosdns-cn ver: 1.4.0
2022-08-06T17:41:47.168+0800 info mosdns-cn/main.go:247 arch: amd64, os: linux, go: go1.18.2
2022-08-06T17:41:47.168+0800 fatal mosdns-cn/main.go:251 failed to init entry, unsupported diversion mode

触发:

  1. 当程序在前台运行时且用CTRL+C结束会触发
  2. 当程序在后台运行时且用kill 结束时会触发

关于 apple,google 的一些站点分流逻辑问题

使用目前的配置,查询 a100.phobos.apple.com,得不到国内 IP。而这个地址应该是包含在 geosite.dat:apple-cn 里面的:

https://github.com/felixonmars/dnsmasq-china-list/blob/51948e34ab9378fc7c9479784a00a185fff09aa0/apple.china.conf#L98

查询日志:

2021-12-22T07:55:16.938+0800	debug	cache	cache/cache.go:109	skipped	{"query": "a100.phobos.apple.com. IN A 64617 1 192.168.2.1:44677"}
2021-12-22T07:55:17.566+0800	debug	remote_upstream	bundled_upstream/bundled_upstream.go:68	response received	{"query": "a100.phobos.apple.com. IN A 64617 1 192.168.2.1:44677", "from": "udp://127.0.0.1:4433"}
2021-12-22T07:55:17.567+0800	debug	dns_handler/server_handler.go:94	entry returned	{"query": "a100.phobos.apple.com. IN A 64617 1 192.168.2.1:44677", "status": "responded"}

mosdns-cn 并未从 local_upstream 查询?

注释掉:
#remote_domain: ['/root/cfg/geosite.dat:geolocation-!cn']
则可以返回国内 IP。

目前不知道 a100.phobos.apple.com 在 geosite.dat:geolocation-!cn 和 geosite.dat:apple-cn 中是怎么个包含关系,导致 mosdns-cn 会直接用 remote_upsteam 查询。

mosdns-cn 配置片段:

local_upstream: [127.0.0.1:533]
local_ip: ['/root/cfg/geoip-only-cn-private.dat:cn']
local_domain: ['/root/cfg/geosite.dat:cn', '/root/cfg/geosite.dat:apple-cn', '/root/cfg/geosite.dat:google-cn']
local_latency: 10
remote_upstream: [127.0.0.1:4433]
remote_domain: ['/root/cfg/geosite.dat:geolocation-!cn']

说明: 之前我并没有使用 '/root/cfg/geosite.dat:apple-cn', '/root/cfg/geosite.dat:google-cn' 这两个列表,发现有问题,添加了,也没解决。

geosite 说明:

@felixonmars/dnsmasq-china-list/apple.china.conf 加入到 geosite:geolocation-!cn 类别中(如希望本文件中的 Apple 域名直连,请参考下面 geosite 的 Routing 配置方式)
@felixonmars/dnsmasq-china-list/google.china.conf 加入到 geosite:geolocation-!cn 类别中(如希望本文件中的 Google 域名直连,请参考下面 geosite 的 Routing 配置方式)

geosite:apple-cn:包含 @felixonmars/dnsmasq-china-list/apple.china.conf 文件里的域名,供希望 Apple 域名直连(不走代理)的用户使用。
geosite:google-cn:包含 @felixonmars/dnsmasq-china-list/google.china.conf 文件里的域名,供希望 Google 域名直连(不走代理)的用户使用。

mosdns-cn 目前分流逻辑:

分流模式中上游的转发顺序:

非 A/AAAA 类型的请求将直接使用 --local-upstream 本地上游。
如果请求的域名匹配到 --local-domain 本地域名。则直接使用 --local-upstream 本地上游。
如果请求的域名匹配到 --remote-domain 远程域名。则直接使用--remote-upstream 远程上游。
同时转发至本地上游获取应答。
如果本地上游的应答包含 --local-ip 本地 IP。则直接采用本地上游的结果
否则使用远程上游。

按照这个顺序,"同时转发至本地上游获取应答。" 如果指的是无论是否匹配到 --local-domain--remote-domain 都会执行,那么即使不添加 geosite.dat:apple-cn , 应该也可以返回国内 IP的? 还是这个 " 同时转发至本地上游获取应答。" 只发生在请求域名不匹配两个列表的情况下才会执行? 实际日志中并没有 local_upsteam 的查询动作。

请教下,能否支持mips_24kc架构的openwrt

请教下,下载后在wndr4300 v1 (Atheros AR9344 rev 2, mips_24kc)上的openwrt上运行时,没有任何反应,用-v没有输出,用--debug及--log-file也不会生成日志,此平台上是否可用,谢谢!

嘿嘿,尾行~小 Bug,-c 参数不指定默认无缓存

如题,设计就是默认没有缓存?

还有范例中:
--remote-domain geosite.dat:geolocation-!cn

这个后面不加引号在 bash 下运行会出错 -bash: !cn: event not found,应该为:
--remote-domain 'geosite.dat:geolocation-!cn'

内存消耗很大

按照分流模式启动后,Windows任务管理器里发现,进程占用内存130MB,这太可怕了

这样能放在路由器上跑么?

能不能优化一下日志

尝试开启--debug --log-file 后,用了一段时间,发现日志文件有点过于庞大,能否考虑优化一下日志大小,比如可以设置日志最高上限为2048Kb这样?

Openwrt 下 --service start 出错

型号:FriendlyElec NanoPi R2S
架构 : ARMv8 Processor rev 4
固件版本:OpenWrt 21.02.1

直接用预编译版本: mosdns-cn-linux-arm64.zip v1.2.3

错误提示:
root@OpenWrt:~# mosdns-cn --service start
2022-05-23T14:10:49.574Z fatal mosdns-cn/main.go:198 start: "service" failed: exec: "service": executable file not found in $PATH

但是通过 /etc/init.d/mosdns-cn start 可以顺利启动 mosdns-cn

另外,请问如何在 Android 下进行?
谢谢!!!

Doh and tls

Is it possible to set up listening address to doh and tls like regular mosdns to install on a VPS and use that as a DNS server?

能否支持屏蔽返回IPV6结果

mosdns里有这个功能,_prefer_ipv4/6: 自动判断域名是否是双栈域名然后屏蔽 IPv4/6 请求,不会影响纯 IPv6/4 域名。

googleapis.cn被local_upstream抢答到北京电信

配置文件部分如下
local_ip: [geoip.dat:cn]
local_domain: [geosite.dat:cn]
remote_domain: [geosite.dat:geolocation-!cn,remotedomain.txt]

我把googleapis.cn写进了remotedomain.txt里面,但是在nslookup查询的时候,依旧被解析到北京电信,查看了log,是被本地电信dns解析了,nslookup services.googleapis.cn 1.1.1.1就是解析到美国谷歌云,导致google play下载的时候一直在pending
请问有什么办法能解决这个问题

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.