Giter Club home page Giter Club logo

mosdns's Introduction

mosdns

功能概述、配置方式、教程等,详见: wiki

下载预编译文件、更新日志,详见: release

docker 镜像: docker hub

mosdns's People

Contributors

chanthmiao avatar dependabot[bot] avatar iiillliilliiill avatar irinesistiana avatar qiusimons avatar sempr avatar urlesistiana 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mosdns's Issues

[BUG] Plugin: blackhole IPv6 setting: is an invalid ipv6 addr

出现了什么问题

描述一下问题的表现。可以直接附上截图或log。建议配置logger插件使用debug级别获取更详细的调试log。

2021-01-26T16:04:06.555+0800	info	mosdns/main.go:136	mosdns ver: v1.2.0-0-ga0c57e1
2021-01-26T16:04:06.555+0800	info	mosdns/main.go:137	arch: amd64, os: linux, go: go1.15.7
2021-01-26T16:04:06.555+0800	info	coremain/run.go:61	loading config	{"file": "config.yaml"}
2021-01-26T16:04:06.556+0800	info	coremain/run.go:97	loading plugin	{"tag": "block"}
2021-01-26T16:04:06.556+0800	fatal	coremain/run.go:38	loading config	{"error": "failed to register plugin #1 block: failed to init plugin [block], [::1] is an invalid ipv6 addr"}

如何重现

描述一下如何重现该问题。请尽可能的包含:

mosdns 的版本号(mosdns -v):

v1.2.0-0-ga0c57e1

使用的启动参数或启动方式:

./mosdns -c config.yaml

操作系统和平台:

The latest version of CentOS7, AMD64

进行了什么操作导致了问题的出现:

blackhole 插件中的 IPv6 设置,只要填写了 IP 就会出现如上的日志中的错误;试过好几个有效的 IPv6 地址都会报错,移除此项则正常

使用的配置文件:

plugin:
  - log:
      level: debug

  - tag: "block"
    type: blackhole
    args:
      ipv4: 0.0.0.0
      ipv6: "[::1]"
      rcode: 0

  - tag: "main_sequence"
    type: sequence
    args:
      exec:
        - _default_cache
        - if:
            - isAds
          exec:
            - block
            - _end

        - if:
            - isCN
          exec:
            - forward_local
            - _end

        - forward_remote
  - tag: main
    type: server
    args:
      entry: main_sequence
      server:
        - protocol: udp
          addr: "127.0.0.1:53"
        - protocol: tcp
          addr: "127.0.0.1:53"

  - tag: forward_local
    type: fast_forward
    args:
      upstream:
        - protocol: udp
          addr: 223.5.5.5:53
          timeout: 2
          trusted: true
        - protocol: udp
          addr: 223.6.6.6:53
          timeout: 2
          trusted: true

  - tag: forward_remote
    type: fast_forward
    args:
      upstream:
        - protocol: dot
          addr: 8.8.8.8
          timeout: 3
          trusted: true
          server_name: dns.google
          insecure_skip_verify: false

  - tag: isAds
    type: query_matcher
    args:
        domain:
          - ./geosite.dat:ads

  - tag: isCN
    type: query_matcher
    args:
      domain:
        - ./geosite.dat:cn

[BUG] 升级到 v0.22.1 后除 hosts 内写死的域名外所有的查询都无返回结果

出现了什么问题

升级到 v0.22.1 后除 hosts 内写死的域名外所有的查询都无返回结果。

Log

time="2021-01-01T17:22:13+08:00" level=info msg="received signal: interrupt, bye" func=github.com/IrineSistiana/mosdns/dispatcher/coremain.Run.func1 file="github.com/IrineSistiana/mosdns/dispatcher/coremain/run.go:38"
time="2021-01-01T17:22:14+08:00" level=info msg="loading plugin my_server" func=github.com/IrineSistiana/mosdns/dispatcher/coremain.loadConfig file="github.com/IrineSistiana/mosdns/dispatcher/coremain/run.go:74"
time="2021-01-01T17:22:14+08:00" level=info msg="loading plugin main_pipeline" func=github.com/IrineSistiana/mosdns/dispatcher/coremain.loadConfig file="github.com/IrineSistiana/mosdns/dispatcher/coremain/run.go:74"
time="2021-01-01T17:22:14+08:00" level=info msg="loading plugin main_sequence" func=github.com/IrineSistiana/mosdns/dispatcher/coremain.loadConfig file="github.com/IrineSistiana/mosdns/dispatcher/coremain/run.go:74"
time="2021-01-01T17:22:14+08:00" level=info msg="loading plugin cloak_hosts" func=github.com/IrineSistiana/mosdns/dispatcher/coremain.loadConfig file="github.com/IrineSistiana/mosdns/dispatcher/coremain/run.go:74"
time="2021-01-01T17:22:14+08:00" level=info msg="loading plugin set_ecs" func=github.com/IrineSistiana/mosdns/dispatcher/coremain.loadConfig file="github.com/IrineSistiana/mosdns/dispatcher/coremain/run.go:74"
time="2021-01-01T17:22:14+08:00" level=info msg="loading plugin with_fallback_cn_dns_serv" func=github.com/IrineSistiana/mosdns/dispatcher/coremain.loadConfig file="github.com/IrineSistiana/mosdns/dispatcher/coremain/run.go:74"
time="2021-01-01T17:22:14+08:00" level=info msg="loading plugin plain_req_pku_and_tuna" func=github.com/IrineSistiana/mosdns/dispatcher/coremain.loadConfig file="github.com/IrineSistiana/mosdns/dispatcher/coremain/run.go:74"
time="2021-01-01T17:22:14+08:00" level=info msg="loading plugin forward_ali_and_tx" func=github.com/IrineSistiana/mosdns/dispatcher/coremain.loadConfig file="github.com/IrineSistiana/mosdns/dispatcher/coremain/run.go:74"
time="2021-01-01T17:22:14+08:00" level=info msg="loading plugin forward_quad9" func=github.com/IrineSistiana/mosdns/dispatcher/coremain.loadConfig file="github.com/IrineSistiana/mosdns/dispatcher/coremain/run.go:74"
time="2021-01-01T17:22:14+08:00" level=info msg="loading plugin query_is_local_domain" func=github.com/IrineSistiana/mosdns/dispatcher/coremain.loadConfig file="github.com/IrineSistiana/mosdns/dispatcher/coremain/run.go:74"
time="2021-01-01T17:22:14+08:00" level=info msg="loading plugin query_is_non_local_domain" func=github.com/IrineSistiana/mosdns/dispatcher/coremain.loadConfig file="github.com/IrineSistiana/mosdns/dispatcher/coremain/run.go:74"
time="2021-01-01T17:22:14+08:00" level=info msg="loading plugin query_is_ad_domain" func=github.com/IrineSistiana/mosdns/dispatcher/coremain.loadConfig file="github.com/IrineSistiana/mosdns/dispatcher/coremain/run.go:74"
time="2021-01-01T17:22:14+08:00" level=info msg="loading plugin match_aaaa" func=github.com/IrineSistiana/mosdns/dispatcher/coremain.loadConfig file="github.com/IrineSistiana/mosdns/dispatcher/coremain/run.go:74"
time="2021-01-01T17:22:14+08:00" level=info msg="loading plugin response_has_local_cdn" func=github.com/IrineSistiana/mosdns/dispatcher/coremain.loadConfig file="github.com/IrineSistiana/mosdns/dispatcher/coremain/run.go:74"
time="2021-01-01T17:22:14+08:00" level=info msg="all plugins are successfully loaded" func=github.com/IrineSistiana/mosdns/dispatcher/coremain.Run file="github.com/IrineSistiana/mosdns/dispatcher/coremain/run.go:47"
time="2021-01-01T17:22:14+08:00" level=debug msg="loaded plugins: [_qtype_A_AAAA main_pipeline main_sequence with_fallback_cn_dns_serv plain_req_pku_and_tuna forward_ali_and_tx forward_quad9 query_is_local_domain _default_cache _no_ecs _query_is_common _response_rcode_success my_logger my_server query_is_ad_domain match_aaaa _drop_response _block_with_servfail _block_with_nxdomain _end cloak_hosts set_ecs query_is_non_local_domain response_has_local_cdn]" func=github.com/IrineSistiana/mosdns/dispatcher/coremain.Run file="github.com/IrineSistiana/mosdns/dispatcher/coremain/run.go:48"
time="2021-01-01T17:22:29+08:00" level=debug msg="HeapObjects: 756735 NumGC: 7 PauseTotalNs: 0, NumGoroutine: 10" func=github.com/IrineSistiana/mosdns/dispatcher/plugin/logger.configLogger.func1 file="github.com/IrineSistiana/mosdns/dispatcher/plugin/logger/logger.go:117"
time="2021-01-01T17:22:44+08:00" level=debug msg="HeapObjects: 756763 NumGC: 7 PauseTotalNs: 0, NumGoroutine: 10" func=github.com/IrineSistiana/mosdns/dispatcher/plugin/logger.configLogger.func1 file="github.com/IrineSistiana/mosdns/dispatcher/plugin/logger/logger.go:117"
time="2021-01-01T17:22:59+08:00" level=debug msg="HeapObjects: 756791 NumGC: 7 PauseTotalNs: 0, NumGoroutine: 10" func=github.com/IrineSistiana/mosdns/dispatcher/plugin/logger.configLogger.func1 file="github.com/IrineSistiana/mosdns/dispatcher/plugin/logger/logger.go:117"
time="2021-01-01T17:23:14+08:00" level=debug msg="HeapObjects: 756828 NumGC: 7 PauseTotalNs: 0, NumGoroutine: 10" func=github.com/IrineSistiana/mosdns/dispatcher/plugin/logger.configLogger.func1 file="github.com/IrineSistiana/mosdns/dispatcher/plugin/logger/logger.go:117"

如何重现

mosdns 的版本号(mosdns -v):
v0.22.1-0-g8c1d997

使用的启动参数或启动方式:
使用发行时压缩包内包含的 winsw XML 配置将 mosdns 安装为系统服务并启动。

操作系统和平台:
WSL

进行了什么操作导致了问题的出现:
dig +nocookie example.com @127.0.0.1

使用的配置文件:

plugin:
  - tag: my_logger
    type: logger
    args:
      level: trace
      file: "./mosdns.log"

  - tag: my_server
    type: server
    args:
      entry: main_pipeline
      max_concurrent_queries: 0
      server:
        - protocol: udp
          addr: 127.0.0.1:53 
        - protocol: tcp
          addr: 127.0.0.1:53 
        - protocol: udp
          addr: "[::1]:53"
        - protocol: tcp
          addr: "[::1]:53"

  ################ Executable Plugin (Route) #################

  - tag: main_pipeline
    type: pipeline
    args:
      pipe:
        - cloak_hosts
        - _default_cache
        - set_ecs
        - main_sequence

  - tag: main_sequence
    type: sequence
    args:
      exec:
        - if:
            - query_is_ad_domain
          exec:
            - _block_with_nxdomain
          goto: _end

        - if:
            - query_is_non_local_domain
          exec:
            - forward_quad9
            - if:
                - match_aaaa
              exec:
                - _drop_response
          goto: _end

        - if:
            - query_is_local_domain
          exec:
            - with_fallback_cn_dns_serv
          goto: _end

        - forward_quad9        # 兜底

  ################# Context Plugin ################

  - tag: cloak_hosts
    type: hosts
    args:
      hosts:
        - ./mosdns-hosts.txt

  ################# Executable Plugin (Function) ################

  - tag: set_ecs
    type: ecs
    args:
      auto: false
      force_overwrite: false
      mask4: 24
      mask6: 32
      ipv4: "1.1.1.1"
      ipv6: "8888:8888:8888:8888:8888:8888:8888:8888"

  - tag: with_fallback_cn_dns_serv
    type: fallback
    args:
      primary:
        - _no_ecs
        - plain_req_pku_and_tuna
      secondary:
        - set_ecs
        - forward_ali_and_tx
      stat_length: 8
      threshold: 4

  - tag: plain_req_pku_and_tuna
    type: fast_forward
    args:
      deduplicate: true
      upstream:
        - protocol: tcp
          addr: 101.6.6.6:5353
          trusted: true
          timeout: 5
          idle_timeout: 10
        - protocol: udp
          addr: 101.6.6.6:53
          trusted: true
          timeout: 5
          idle_timeout: 10

  - tag: forward_ali_and_tx
    type: forward
    args:
      upstream:
        - addr: https://223.5.5.5/dns-query
        - addr: tls://223.6.6.6
        - addr: https://doh.pub/dns-query
        - addr: tls://dns.pub
      deduplicate: true
      insecure_skip_verify: false
      timeout: 10
      bootstrap:
        - 119.29.29.29:53
        - 119.28.28.28:53
        - 223.5.5.5:53
        - 223.6.6.6:53

  - tag: forward_quad9
    type: forward
    args:
      upstream:
        - addr: https://9.9.9.11/dns-query
      deduplicate: true
      insecure_skip_verify: false
      timeout: 10

  ################ Matcher Plugin #################

  - tag: query_is_local_domain        # 匹配本地域名的插件
    type: query_matcher
    args:
      qtype: [1, 28]
      domain:                         # 匹配请求域名的域名表
        - "./geosite.dat:cn"
        - "./dnsmasq-china-list.txt"

  - tag: query_is_non_local_domain    # 匹配非本地域名的插件
    type: query_matcher
    args:
      qtype: [1, 28]
      domain:
        - "./geosite.dat:geolocation-!cn"

  - tag: query_is_ad_domain           # 匹配广告域名的插件
    type: query_matcher
    args:
      qtype: [1, 28]
      domain:
        - "./geosite.dat:category-ads-all"

  - tag: match_aaaa
    type: query_matcher
    args:
      qtype: [28]

  - tag: response_has_local_cdn
    type: response_matcher
    args:
      rcode: [0]
      CNAME:                          # 匹配应答 CNAME 记录的域名表
        - ./dnsmasq-china-list.txt
      ## Tips: CNAME 记录有助于识别该域名背后的关联域名,比如 CDN。

关于forward插件的一些疑问

你好,目前我使用的是1.1.0,关于forward,做了一下配置:

  - tag: forward_smartdns 
    type: forward
    args:
      upstream:
        - addr: 127.0.0.1:5351

上游服务器用的是smartdns来解析国内域名,目的是利用smartdns的并发请求跟测速,来选择国内最有IP。
刚刚看到1.1.1版本更新了fastest_ip选项,看到issue里面说到是一个类似smartdns的测速功能,那么,我是不是可以通过以下配置,达到跟smartdns一样效果呢

  - tag: forward_cn
    type: forward
    args:
      upstream:
        - addr: 223.5.5.5
        - addr: 223.6.6.6
        - addr: 114.114.114.114
        - addr: 114.114.115.115
      fastest_ip: ture

这样配置的话,当调用到forward_cn的话,upstream里的所有服务器,是同时发起请求呢,还是逐一请求呢?

配置问题请教

看到示例配置的这一段:

      # 非 A AAAA 的请求另行处理
      - if:
          - "!match_qtype_A_AAAA" # 匹配非 A AAAA 的请求(插件类型: qtype_matcher)
        exec:
          - forward_local         # 转发至本地服务器(插件类型: forward)
        goto: end                 # 结束(不再执行后续插件。立即返回应答至客户端)

      - forward_local             # 转发至本地服务器

      # 过滤出本地结果
      - if:
          - match_local_domain      # 匹配已知的本地域名
          - match_local_ip          # 或应答包含本地 IP
        goto: end                 # 结束

      # 剩余请求(既不是已知的本地域名,也没有返回本地 IP)
      - forward_remote    # 转发至远程服务器
    next: end             # 结束

有几个问题有点没明白:

  1. 为何第二个forward_local不是放在exec里,而是在外面?
  2. 为何过滤本地结果没有exec,且没有forward_local?

按照我的理解,这个按顺序从上至下执行的话,那这样写,执行起来好像会有问题?所以还请作者详细解释一下这部分的执行过程?以便更好的理解配置。

[Feature request] 实现与 `dnscrypt-proxy` 项目相同的 HOSTS 语法

希望添加的功能

我稍微深挖了一下这个项目的所有内置插件,非常实用。其中匹配器插件 hosts 的语法我仔细看了一下和 https://github.com/DNSCrypt/dnscrypt-proxy 项目的 Cloaking 语法非常相似(这里的 Cloaking 基本就是 hosts 插件实现的功能)
我这里把所有 Cloaking 的语法细节列出来,与 hosts 插件一致的会用对勾标记:

  • 域名在前,IP 在后
  • 一条域名后面可以指定多个 IP
  • 多行出现的相同域名不会覆盖,而是被合并
  • 支持 IPv6
    • (不使用方括号包裹 IPv6 地址)
  • 支持以域名作为某一条目的别名(即对 a.b.c 域名的查询返回 d.e.f 的结果)
  • 支持通配符
    • 值得注意的语法差异:不加修饰符,单纯域名在 hosts 插件中只匹配完整域名;但在 https://github.com/DNSCrypt/dnscrypt-proxy 项目中还匹配这一级域名下的所有子域名。

个人希望 mosdns 项目的 hosts 插件语法可以做到和 https://github.com/DNSCrypt/dnscrypt-proxy 项目一致,这样可以更方便地分享已有的 hosts 文件成果。而且支持通配符匹配也确实会大大增强 hosts 插件的能力。


附:
Cloaking 语法官方 Wiki 说明

[BUG] 1.3版本崩溃 fatal error: concurrent map writes

出现了什么问题
同配置1.2升级到1.3以后,使用10来分钟之后,会出现崩溃,进程状态变成Z。
重复出现3次,回退到1.2之后一切正常。

# ps |grep mos
 2402 admin        0 Z    [mosdns]
 2471 admin     1716 S    grep mos
 # killall mosdns

 # ./mosdns &
 # 2021-01-29T13:02:30.859Z	info	mosdns/main.go:136	mosdns ver: v1.3.0-0-g6e24aef
2021-01-29T13:02:30.860Z	info	mosdns/main.go:137	arch: mipsle, os: linux, go: go1.15.7
2021-01-29T13:02:30.861Z	info	coremain/run.go:61	loading config	{"file": "config.yaml"}
2021-01-29T13:02:30.873Z	info	coremain/run.go:97	loading plugin	{"tag": "main_server"}
2021-01-29T13:02:30.875Z	info	main_server	server/udp.go:56	udp server started	{"addr": "[::]:53"}
2021-01-29T13:02:30.877Z	info	coremain/run.go:97	loading plugin	{"tag": "main_sequence"}
2021-01-29T13:02:30.879Z	info	coremain/run.go:97	loading plugin	{"tag": "forward_local"}
2021-01-29T13:02:30.881Z	info	coremain/run.go:97	loading plugin	{"tag": "forward_remote"}
2021-01-29T13:02:30.883Z	info	coremain/run.go:97	loading plugin	{"tag": "query_is_local_domain"}
2021-01-29T13:02:31.569Z	info	coremain/run.go:97	loading plugin	{"tag": "query_is_non_local_domain"}
2021-01-29T13:02:31.570Z	info	coremain/run.go:97	loading plugin	{"tag": "query_is_ad_domain"}
2021-01-29T13:02:31.683Z	info	coremain/run.go:97	loading plugin	{"tag": "match_blackip"}
2021-01-29T13:02:31.691Z	info	coremain/run.go:41	all plugins are successfully loaded
fatal error: concurrent map writes
fatal error: concurrent map writes

goroutine 887 [running]:
runtime.throw(0x92cff8, 0x15)
	runtime/panic.go:1116 +0x60 fp=0x1b064b4 sp=0x1b064a0 pc=0x4fe24
runtime.mapdelete_faststr(0x85f600, 0x10615c0, 0x1b56360, 0x2f)
	runtime/map_faststr.go:377 +0x418 fp=0x1b064e8 sp=0x1b064b4 pc=0x26144
github.com/IrineSistiana/mosdns/dispatcher/utils.(*LRU).mustDel(0x100a320, 0x1b56360, 0x2f, 0x1cbef20)
	github.com/IrineSistiana/mosdns/dispatcher/utils/lru.go:77 +0xf0 fp=0x1b06500 sp=0x1b064e8 pc=0x477f18
github.com/IrineSistiana/mosdns/dispatcher/utils.(*LRU).Del(...)
	github.com/IrineSistiana/mosdns/dispatcher/utils/lru.go:71
github.com/IrineSistiana/mosdns/dispatcher/plugin/cache.(*memCache).get(0x105e630, 0x9feea0, 0x15f6c40, 0x1b56360, 0x2f, 0x0, 0x0, 0x0, 0xaae14125, 0xffffffee, ...)
	github.com/IrineSistiana/mosdns/dispatcher/plugin/cache/mem_cache.go:79 +0x2f8 fp=0x1b06554 sp=0x1b06500 pc=0x558a5c
github.com/IrineSistiana/mosdns/dispatcher/plugin/cache.(*cachePlugin).searchAndReply(0x100a330, 0x9feea0, 0x15f6c40, 0x1af3630, 0x1b56360, 0x2f, 0x40f200)
	github.com/IrineSistiana/mosdns/dispatcher/plugin/cache/plugin.go:124 +0x368 fp=0x1b06844 sp=0x1b06554 pc=0x559a7c
github.com/IrineSistiana/mosdns/dispatcher/plugin/cache.(*cachePlugin).ExecES(0x100a330, 0x9feea0, 0x15f6c40, 0x1af3630, 0x775d0ab4, 0x1af3720, 0x103a240)
	github.com/IrineSistiana/mosdns/dispatcher/plugin/cache/plugin.go:92 +0x54 fp=0x1b0687c sp=0x1b06844 pc=0x5594ac
github.com/IrineSistiana/mosdns/dispatcher/handler.(*PluginWrapper).ExecES(0x105e660, 0x9feea0, 0x15f6c40, 0x1af3630, 0x2, 0x2, 0x2)
	github.com/IrineSistiana/mosdns/dispatcher/handler/plugin_wrapper.go:111 +0x2e0 fp=0x1b068cc sp=0x1b0687c pc=0x40f528
github.com/IrineSistiana/mosdns/dispatcher/utils.executablePluginTag.ExecCmd(0x12901b0, 0xe, 0x9feea0, 0x15f6c40, 0x1af3630, 0x12803f0, 0x1, 0x0, 0x0, 0x0, ...)
	github.com/IrineSistiana/mosdns/dispatcher/utils/executable_sequence.go:48 +0x264 fp=0x1b06984 sp=0x1b068cc pc=0x47324c
github.com/IrineSistiana/mosdns/dispatcher/utils.(*executablePluginTag).ExecCmd(0x1286f50, 0x9feea0, 0x15f6c40, 0x1af3630, 0x12803f0, 0x0, 0x0, 0x0, 0x0, 0x0)
	<autogenerated>:1 +0x94 fp=0x1b069b4 sp=0x1b06984 pc=0x47e508
github.com/IrineSistiana/mosdns/dispatcher/utils.(*ExecutableCmdSequence).ExecCmd(0x12849a0, 0x9feea0, 0x15f6c40, 0x1af3630, 0x12803f0, 0x0, 0x0, 0x0, 0x0, 0x0)
	github.com/IrineSistiana/mosdns/dispatcher/utils/executable_sequence.go:602 +0xa0 fp=0x1b069ec sp=0x1b069b4 pc=0x476d24
github.com/IrineSistiana/mosdns/dispatcher/utils.WalkExecutableCmd(0x9feea0, 0x15f6c40, 0x1af3630, 0x12803f0, 0x9f76a0, 0x12849a0, 0x83d1e0, 0x5)
	github.com/IrineSistiana/mosdns/dispatcher/utils/executable_sequence.go:621 +0x68 fp=0x1b06ab4 sp=0x1b069ec pc=0x476e50
github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/sequence.(*sequenceRouter).Exec(0x1287210, 0x9feea0, 0x15f6c40, 0x1af3630, 0x775d0ab4, 0x1af36d0)
	github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/sequence/sequence.go:64 +0x70 fp=0x1b06ad8 sp=0x1b06ab4 pc=0x68e660
github.com/IrineSistiana/mosdns/dispatcher/handler.(*PluginWrapper).ExecES(0x1280750, 0x9feea0, 0x15f6c40, 0x1af3630, 0x2, 0x2, 0x0)
	github.com/IrineSistiana/mosdns/dispatcher/handler/plugin_wrapper.go:113 +0xa0 fp=0x1b06b28 sp=0x1b06ad8 pc=0x40f2e8
github.com/IrineSistiana/mosdns/dispatcher/utils.executablePluginTag.ExecCmd(0x1290100, 0xd, 0x9feea0, 0x15f6c40, 0x1af3630, 0x1280240, 0x775d9a68, 0x80, 0x80, 0x775d0ab4, ...)
	github.com/IrineSistiana/mosdns/dispatcher/utils/executable_sequence.go:48 +0x264 fp=0x1b06be0 sp=0x1b06b28 pc=0x47324c
github.com/IrineSistiana/mosdns/dispatcher/utils.(*executablePluginTag).ExecCmd(0x1286eb8, 0x9feea0, 0x15f6c40, 0x1af3630, 0x1280240, 0x102ca00, 0x382bb0, 0x8d7cb043, 0xbffd1ff0, 0x156caff4)
	<autogenerated>:1 +0x94 fp=0x1b06c10 sp=0x1b06be0 pc=0x47e508
github.com/IrineSistiana/mosdns/dispatcher/utils.(*ExecutableCmdSequence).ExecCmd(0x1284940, 0x9feea0, 0x15f6c40, 0x1af3630, 0x1280240, 0x33, 0xe061e0, 0x0, 0x1e798, 0x25c8c)
	github.com/IrineSistiana/mosdns/dispatcher/utils/executable_sequence.go:602 +0xa0 fp=0x1b06c48 sp=0x1b06c10 pc=0x476d24
github.com/IrineSistiana/mosdns/dispatcher/utils.WalkExecutableCmd(0x9feea0, 0x15f6c40, 0x1af3630, 0x1280240, 0x9f76a0, 0x1284940, 0x6d48c, 0x195c378)
	github.com/IrineSistiana/mosdns/dispatcher/utils/executable_sequence.go:621 +0x68 fp=0x1b06d10 sp=0x1b06c48 pc=0x476e50
github.com/IrineSistiana/mosdns/dispatcher/utils.(*DefaultServerHandler).execEntry(0x1286ec0, 0x9feea0, 0x15f6c40, 0x1af3630, 0x1136900, 0x77590250)
	github.com/IrineSistiana/mosdns/dispatcher/utils/server_handler.go:106 +0x70 fp=0x1b06d34 sp=0x1b06d10 pc=0x47a74c
github.com/IrineSistiana/mosdns/dispatcher/utils.(*DefaultServerHandler).ServeDNS(0x1286ec0, 0x9feea0, 0x15f6c40, 0x1af3630, 0x9f7660, 0x1cbf1c0)
	github.com/IrineSistiana/mosdns/dispatcher/utils/server_handler.go:81 +0x78 fp=0x1b06fac sp=0x1b06d34 pc=0x479c74
github.com/IrineSistiana/mosdns/dispatcher/plugin/server.(*ServerGroup).startUDP.func1.1(0x9fee60, 0x11f51e0, 0x1280330, 0x1af3630, 0x1cbf1c0)
	github.com/IrineSistiana/mosdns/dispatcher/plugin/server/udp.go:91 +0xb8 fp=0x1b06fd4 sp=0x1b06fac pc=0x764d58
runtime.goexit()
	runtime/asm_mipsx.s:651 +0x4 fp=0x1b06fd4 sp=0x1b06fd4 pc=0x9207c
created by github.com/IrineSistiana/mosdns/dispatcher/plugin/server.(*ServerGroup).startUDP.func1
	github.com/IrineSistiana/mosdns/dispatcher/plugin/server/udp.go:88 +0x3c4


如何重现
mosdns 的版本号(mosdns -v):
1.3
操作系统和平台:
路由器Linux 3.4.113 mipsel softfloat
进行了什么操作导致了问题的出现:
正常使用数分钟后出现。

[Feature request] 功能插件如 `forward` 支持错误重试功能

希望添加的功能

使用场景:在 forward 插件中配置使用清华 DoH 服务,观察日志发现偶尔出现 503 错误。

time="2020-12-21T15:49:29+08:00" level=warning msg="[{********.skt.ipip.net. 28 1}]: t: 55 ms, from: [::1]:57540, network: udp: upstream failed: got an unexpected HTTP status code 503 from 'https://101.6.6.6:8443/resolve'" plugin=forward_local
time="2020-12-21T15:49:30+08:00" level=warning msg="[{********.skt.ipip.net. 28 1}]: t: 31 ms, from: 127.0.0.1:57540, network: udp: upstream failed: got an unexpected HTTP status code 503 from 'https://101.6.6.6:8443/resolve'" plugin=forward_local
time="2020-12-21T15:49:30+08:00" level=warning msg="[{********.skt.ipip.net. 28 1}]: t: 6 ms, from: [::1]:50150, network: udp: upstream failed: got an unexpected HTTP status code 503 from 'https://101.6.6.6:8443/resolve'" plugin=forward_local
time="2020-12-21T15:49:30+08:00" level=warning msg="[{********.skt.ipip.net. 28 1}]: t: 31 ms, from: 127.0.0.1:50150, network: udp: upstream failed: got an unexpected HTTP status code 503 from 'https://101.6.6.6:8443/resolve'" plugin=forward_local

目前的临时应对方法是在配置文件中做如下修改:

        - if:
            - match_non_local_domain
          exec:
            - forward_remote
+           - if:
+               - _response_has_err_rcode
+             exec:
+               - fallback_with_plain_request
          goto: _end

+ - tag: fallback_with_plain_request
+   type: fast_forward
+   args:
+     upstream:
+       - udp://0.0.0.1:53
+       - udp://0.0.0.2:53
+       - udp://0.0.0.3:53
+       - tcp://0.0.0.4:53
+       - tcp://101.6.6.6:5353

但我并不太希望因为短暂的服务不可用就降级到明文 DNS 请求。

[Feature request] 支持 AdguardTeam/dnsproxy 的 fastest-addr 功能

支持 AdguardTeam/dnsproxy 的 fastest-addr 功能

This option would be useful to the users with problematic network connection. In this mode, dnsproxy would detect the fastest IP address among all that were returned, and it will return only it.

./dnsproxy -u 8.8.8.8 -u 1.1.1.1 --cache --cache-min-ttl=600 --fastest-addr

类似 smartdns 的测速功能

[BUG]插件无法匹配域名

出现了什么问题
百度/JD网站无法匹配中"China_domain",而是显示匹配中"China_ip" ,匹配指定其他网站也出现相同情况
描述一下问题的表现。可以直接附上截图或log。建议配置logger插件使用debug级别获取更详细的调试log。

2021-02-08T21:19:17.700+0800	debug	main_server	server/udp.go:86	                                 new query	{"query": "www.baidu.com. 1 1 43655 57", "from": "192.168.50.1:39583"}
2021-02-08T21:19:17.700+0800	debug	main_server	server/udp.go:86	                                 new query	{"query": "www.baidu.com. 28 1 60686 58", "from": "192.168.50.1:13172"}
2021-02-08T21:19:17.700+0800	debug	main_server	utils/executable_sequence.go:47	        exec executable plugin	{"query": "www.baidu.com. 28 1 60686 58", "exec": "_default_cache"}
2021-02-08T21:19:17.700+0800	debug	main_server	utils/executable_sequence.go:47	        exec executable plugin	{"query": "www.baidu.com. 28 1 60686 58", "exec": "add_ecs"}
2021-02-08T21:19:17.700+0800	debug	main_server	utils/executable_sequence.go:47	        exec executable plugin	{"query": "www.baidu.com. 28 1 60686 58", "exec": "main_sequence"}
2021-02-08T21:19:17.700+0800	debug	main_sequence	utils/executable_sequence.go:137	    exec matcher plugin	{"query": "www.baidu.com. 28 1 60686 58", "exec": "AD_domain", "result": false}
2021-02-08T21:19:17.700+0800	debug	main_sequence	utils/executable_sequence.go:137	    exec matcher plugin	{"query": "www.baidu.com. 28 1 60686 58", "exec": **"China_domain", "result": false**}
2021-02-08T21:19:17.700+0800	debug	main_sequence	utils/executable_sequence.go:47	     exec executable plugin	{"query": "www.baidu.com. 28 1 60686 58", "exec": "Forward_Internal"}
2021-02-08T21:19:17.700+0800	debug	main_server	utils/executable_sequence.go:47	      exec    executable plugin	{"query": "www.baidu.com. 1 1 43655 57", "exec": "_default_cache"}
2021-02-08T21:19:17.700+0800	debug	main_server	utils/executable_sequence.go:47	        exec executable plugin	{"query": "www.baidu.com. 1 1 43655 57", "exec": "add_ecs"}
2021-02-08T21:19:17.700+0800	debug	main_server	utils/executable_sequence.go:47	        exec executable plugin	{"query": "www.baidu.com. 1 1 43655 57", "exec": "main_sequence"}
2021-02-08T21:19:17.700+0800	debug	main_sequence	utils/executable_sequence.go:137	    exec matcher plugin	{"query": "www.baidu.com. 1 1 43655 57", "exec": "AD_domain", "result": false}
2021-02-08T21:19:17.700+0800	debug	main_sequence	utils/executable_sequence.go:137	    exec matcher plugin	{"query": "www.baidu.com. 1 1 43655 57", "exec": "China_domain", "result": false}
2021-02-08T21:19:17.700+0800	debug	main_sequence	utils/executable_sequence.go:47	    exec executable plugin	{"query": "www.baidu.com. 1 1 43655 57", "exec": "Forward_Internal"}
2021-02-08T21:19:17.702+0800	debug	Forward_Internal	utils/utils.go:303	                received response	{"query": "www.baidu.com. 1 1 43655 57", "from": "tcp://127.0.0.1:54"}
2021-02-08T21:19:17.702+0800	debug	main_sequence	utils/executable_sequence.go:137	    exec matcher plugin	{"query": "www.baidu.com. 1 1 43655 57", "exec": **"China_ip", "result": true**}
2021-02-08T21:19:17.702+0800	debug	main_sequence	utils/executable_sequence.go:622	            goto plugin	{"query": "www.baidu.com. 1 1 43655 57", "goto": "_end"}
2021-02-08T21:19:17.702+0800	debug	main_server	utils/server_handler.go:85	                entry returned	    {"query": "www.baidu.com. 1 1 43655 57", "status": "responded"}
2021-02-08T21:19:17.704+0800	debug	Forward_Internal	utils/utils.go:303	                received response	{"query": "www.baidu.com. 28 1 60686 58", "from": "tcp://127.0.0.1:54"}
2021-02-08T21:19:17.704+0800	debug	main_sequence	utils/executable_sequence.go:137	    exec matcher plugin	{"query": "www.baidu.com. 28 1 60686 58", "exec": "China_ip", "result": false}
2021-02-08T21:19:17.704+0800	debug	main_sequence	utils/executable_sequence.go:47	    exec executable plugin	{"query": "www.baidu.com. 28 1 60686 58", "exec": "Forward_Foreign"}

如何重现

描述一下如何重现该问题。请尽可能的包含:

mosdns 的版本号(mosdns -v):
v1.3.4-0-gc51a109
使用的启动参数或启动方式:
mosdns -c 配置文件
操作系统和平台:
centos7 x64
进行了什么操作导致了问题的出现:
解析网站出现此问题
使用的配置文件:

        - if:
            - China_domain   # 已知的本地域名
          exec:
            - Forward_Internal           # 用本地服务器
          goto: _end
          
        - Forward_Internal               # 先请求转发至本地服务器

        - if:
            - China_ip   # 如果应答包含本地 IP
          goto: _end # 就直接采用结果


  - tag: "China_domain"
    type: response_matcher
    args:
        cname:
          - "工作目录/geosite.dat:google-cn"
          - "工作目录/geosite.dat:tld-cn"
          - "工作目录/geosite.dat:private"
          - "工作目录/geosite.dat:cn"
          - "工作目录/china_domain.list"

  - tag: "China_ip"
    type: response_matcher
    args:
      ip:
          - "/usr/config/mosdns/rules/china_ip.txt"
          - "/usr/config/mosdns/rules/china_ipv6.txt"
          - "/usr/config/mosdns/rules/geoip.dat:cn" 

#以上均有百度/JD 的IP &域名 

[Feature request] 对 `v2fly/domain-list-community` 项目中 `@attr` 的支持

希望添加的功能

我没有确认到目前是否已经实现了这个功能,所以如果已经实现了,请轻拍(
目前 Wiki 配置里的以下部分用到了 https://github.com/v2fly/domain-list-community 项目的 geolocation-!cn 数据,这部分数据里其实包含了不少接入点在国内的域名,曾经就给 shadowsocks 用户造成过困扰。(Refer: https://github.com/shadowsocks/shadowsocks-windows/issues/2971)

  - tag: match_non_local_domain   # 匹配非本地域名
    type: domain_matcher
    args:
      check_cname: false
      check_question: true
      domain:
        - "./geosite.dat:geolocation-!cn"

个人认为这块相当有必要进行修改,尚不知道作者打算如何处理这种在引用 geosite.dat 文件中数据时 排除 某个 attr 的需要。

[BUG]动态插件报错:plugin: not implemented

CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build --buildmode=plugin -ldflags "-s -w -X main.version=v1.3.4-0-gc51a109" -trimpath -o ./ping.so ./dispatcher/plugin/executable/ping/ping.go

这样编译出来的插件加载报错plugin: not implemented

然后我看项目是发布是

CGO_ENABLED: '0'

于是改成CGO_ENABLED=0,但编译又报错了loadinternal: cannot find runtime/cgo

然后我把项目clone下来,自己编译为CGO_ENABLED=1,这样插件就能正常加载

谷歌半天找到golang/go#19569

无解了吗?

[Feature request] 关于细化log 输出格式的建议

希望添加的功能

有时候在局域网中 会需要查询 来自某些个固定IP 的dns 请求. 目前的考虑是 是否

  1. 在每个插件里 指定是否这个插件的运行过程和结果单独记录日志 并指定前缀,可以适当省略 日志来源的源文件 信息(比如多少行).
  2. 在log 的插件内指定某些条件组合 输出 需要的内容 包括不限于 查询来源IP, 查询类型, 查询内容, 处理的插件,返回的结果之类的. 也是可以省略很多 堆栈信息. 直接输出需要的内容

请教下配置文件的编写

以下是我的配置文件

log:
  level: ""
  file: ""
server:
  bind:
    - udp://127.0.0.1:53300
    - tcp://127.0.0.1:53300
  max_udp_size: 1472
plugin:
  entry:
    - "route1"
  router: []
  matcher: []
  functional: []
  plugin:
    - tag: "local_ecs"
      type: ecs
      args:
        auto: false
        force_overwrite: false
        ipv4: ""
        ipv6: ""
        mask4: 24
        mask6: 32
    - tag: "local_dnsserver"
      type: forward
      args:
        bootstrap:
          - https://223.5.5.5/dns-query
        deduplicate: false
        insecure_skip_verify: false
        timeout: 10
        upstream:
          - addr: tcp://101.6.6.6:5353
            ip_addr: []
          - addr: https://dns.alidns.com/dns-query
            ip_addr:
              - 223.5.5.5
              - 223.6.6.6
    - tag: "remote_dnsserver"
      type: forward
      args:
        bootstrap:
          - https://223.5.5.5/dns-query
          - https://1.1.1.1/dns-query
        deduplicate: false
        insecure_skip_verify: false
        timeout: 10
        upstream:
          - addr: https://dns.google/dns-query
            ip_addr:
              - 8.8.8.8
              - 8.8.4.4
          - addr: https://cloudflare-dns.com/dns-query
            ip_addr:
              - 1.1.1.1
              - 1.0.0.1
    - tag: "chn_domain"
      type: domain_matcher
      args:
        check_cname: true
        check_question: true
        domain:
          - "./chn_domain.list"
          - "./geosite.dat:cn"
    - tag: "non_chn_domain"
      type: domain_matcher
      args:
        check_cname: true
        check_question: true
        domain:
          - "./non_chn_domain.list"
          - "./geosite.dat:geolocation-!cn"
    - tag: "chn_ip"
      type: ip_matcher
      args:
        ip:
          - "./chn_ip.list"
          - "./geoip.dat:cn"
    - tag: "qtype_A_AAAA"
      type: qtype_matcher
      args:
        type:
          - 1
          - 28
    - tag: "route1"
      type: sequence
      args:
        exec:
          - if:
              - "!match_qtype_A_AAAA"
            exec:
              - forward_local_dnsserver
            goto: end
          - if:
              - "match_chn_domain"
              - "match_chn_ip"
            exec:
              - add_local_ecs
              - forward_local_dnsserver
            goto: end
          - if:
              - "match_non_chn_domain"
            exec:
              - forward_remote_dnsserver
            goto: end
          - forward_remote_dnsserver
        next: end
    - tag: "block"
      type: blackhole
      args:
        rcode: 0

运行时会提示以下内容

WARN[0003] [{www.baidu.com. 1 1}], from: 192.168.0.196:63279: query failed: plugin tag route1 not not defined 
WARN[0016] [{www.youtube.com. 1 1}], from: 192.168.0.196:63280: query failed: plugin tag route1 not not defined

请教下这份配置要怎么改才能正常使用?

[BUG] 使用一段时间会出现错误

time="2020-12-xxTxx:xx:xx+08:00" level=warning msg="[{weixin.qq.com. 1 1}], from: 127.0.0.1:49460: query failed: plugin sequence_bypass_local reports an err: context deadline exceeded"

会出现这样的错误。

[Feature request] blackhole插件返回特定IP

希望添加的功能

blackhole插件返回特定IP

目前的blackhole基于返回特定错误代码,但与Clash配合使用是会出现以下问题:

time="2020-12-27T18:42:54+08:00" level=info msg="[TCP] 127.0.0.1:5940 --> ws.infinitynewtab.com match Match() using Oversea[US]"
time="2020-12-27T18:43:00+08:00" level=info msg="[TCP] 127.0.0.1:5949 --> ws.infinitynewtab.com match Match() using Oversea[US]"
time="2020-12-27T18:43:01+08:00" level=info msg="[TCP] 127.0.0.1:5951 --> ws.infinitynewtab.com match Match() using Oversea[US]"
time="2020-12-27T18:43:06+08:00" level=info msg="[TCP] 127.0.0.1:5959 --> ws.infinitynewtab.com match Match() using Oversea[US]"
time="2020-12-27T18:43:07+08:00" level=info msg="[TCP] 127.0.0.1:5961 --> ws.infinitynewtab.com match Match() using Oversea[US]"
time="2020-12-27T18:43:12+08:00" level=info msg="[TCP] 127.0.0.1:5969 --> ws.infinitynewtab.com match Match() using Oversea[US]"
time="2020-12-27T18:43:13+08:00" level=info msg="[TCP] 127.0.0.1:5971 --> ws.infinitynewtab.com match Match() using Oversea[US]"
time="2020-12-27T18:43:18+08:00" level=info msg="[TCP] 127.0.0.1:5986 --> ws.infinitynewtab.com match Match() using Oversea[US]"

未解析成功的域名会直接发送至远端解析;host插件又无法同geosite.dat相结合,此功能亦无法利用host实现。结果是,对于双向计费的服务器不太友好。

希望blackhole可返回一个例如127.173.173.173这样的特殊IP(173=0xad),之后针对指向该IP的连接进行处理即可。

[BUG] v0.21.0 的缓存问题

出现了什么问题

使用 wiki 的示例配置,多次查询发现缓存似乎并未生效?调试信息里面也看不上到缓存命中直接返回的相关信息。

time="2020-12-30T11:58:53+08:00" level=debug msg="[{twitter.com. 1 1}], id: 13798, t: 0 ms, from: udp://127.0.0.1:31243: exec context plugin _default_cache" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*PipeContext).ExecNextPlugin" file="github.com/IrineSistiana/mosdns/dispatcher/handler/context_plugin.go:54" plugin=pipeline
time="2020-12-30T11:58:53+08:00" level=debug msg="[{twitter.com. 1 1}], id: 13798, t: 0 ms, from: udp://127.0.0.1:31243: exec executable plugin main_sequence" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*PipeContext).ExecNextPlugin" file="github.com/IrineSistiana/mosdns/dispatcher/handler/context_plugin.go:57" plugin=pipeline
time="2020-12-30T11:58:53+08:00" level=debug msg="[{twitter.com. 1 1}], id: 13798, t: 0 ms, from: udp://127.0.0.1:31243: exec matcher plugin match_ad_domain, returned: false" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*ifBlock).ExecCmd" file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:108" plugin=main_sequence
time="2020-12-30T11:58:53+08:00" level=debug msg="[{twitter.com. 1 1}], id: 13798, t: 1 ms, from: udp://127.0.0.1:31243: exec matcher plugin match_local_domain, returned: false" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*ifBlock).ExecCmd" file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:108" plugin=main_sequence
time="2020-12-30T11:58:53+08:00" level=debug msg="[{twitter.com. 1 1}], id: 13798, t: 1 ms, from: udp://127.0.0.1:31243: exec matcher plugin _query_type_is_unusual, returned: false" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*ifBlock).ExecCmd" file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:108" plugin=main_sequence
time="2020-12-30T11:58:53+08:00" level=debug msg="[{twitter.com. 1 1}], id: 13798, t: 1 ms, from: udp://127.0.0.1:31243: exec matcher plugin match_non_local_domain, returned: true" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*ifBlock).ExecCmd" file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:108" plugin=main_sequence
time="2020-12-30T11:58:53+08:00" level=debug msg="[{twitter.com. 1 1}], id: 13798, t: 1 ms, from: udp://127.0.0.1:31243: exec plugin forward_remote" func=github.com/IrineSistiana/mosdns/dispatcher/handler.executablePluginTag.ExecCmd file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:72" plugin=main_sequence
time="2020-12-30T11:58:53+08:00" level=debug msg="[{twitter.com. 1 1}], id: 13798, t: 169 ms, from: udp://127.0.0.1:31243: goto plugin _end" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*ExecutableCmdSequence).Exec" file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:204" plugin=main_sequence
time="2020-12-30T11:58:57+08:00" level=debug msg="[{twitter.com. 1 1}], id: 25131, t: 0 ms, from: udp://127.0.0.1:28551: exec context plugin _default_cache" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*PipeContext).ExecNextPlugin" file="github.com/IrineSistiana/mosdns/dispatcher/handler/context_plugin.go:54" plugin=pipeline
time="2020-12-30T11:58:57+08:00" level=debug msg="[{twitter.com. 1 1}], id: 25131, t: 0 ms, from: udp://127.0.0.1:28551: exec executable plugin main_sequence" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*PipeContext).ExecNextPlugin" file="github.com/IrineSistiana/mosdns/dispatcher/handler/context_plugin.go:57" plugin=pipeline
time="2020-12-30T11:58:57+08:00" level=debug msg="[{twitter.com. 1 1}], id: 25131, t: 0 ms, from: udp://127.0.0.1:28551: exec matcher plugin match_ad_domain, returned: false" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*ifBlock).ExecCmd" file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:108" plugin=main_sequence
time="2020-12-30T11:58:57+08:00" level=debug msg="[{twitter.com. 1 1}], id: 25131, t: 0 ms, from: udp://127.0.0.1:28551: exec matcher plugin match_local_domain, returned: false" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*ifBlock).ExecCmd" file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:108" plugin=main_sequence
time="2020-12-30T11:58:57+08:00" level=debug msg="[{twitter.com. 1 1}], id: 25131, t: 1 ms, from: udp://127.0.0.1:28551: exec matcher plugin _query_type_is_unusual, returned: false" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*ifBlock).ExecCmd" file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:108" plugin=main_sequence
time="2020-12-30T11:58:57+08:00" level=debug msg="[{twitter.com. 1 1}], id: 25131, t: 1 ms, from: udp://127.0.0.1:28551: exec matcher plugin match_non_local_domain, returned: true" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*ifBlock).ExecCmd" file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:108" plugin=main_sequence
time="2020-12-30T11:58:57+08:00" level=debug msg="[{twitter.com. 1 1}], id: 25131, t: 1 ms, from: udp://127.0.0.1:28551: exec plugin forward_remote" func=github.com/IrineSistiana/mosdns/dispatcher/handler.executablePluginTag.ExecCmd file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:72" plugin=main_sequence
time="2020-12-30T11:58:57+08:00" level=debug msg="[{twitter.com. 1 1}], id: 25131, t: 169 ms, from: udp://127.0.0.1:28551: goto plugin _end" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*ExecutableCmdSequence).Exec" file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:204" plugin=main_sequence

dig 查询时间,第二次和第一次时间一样为 168ms:(如果更换为国内常见域名,第一次查询时间会很短,比如 12ms,但是之后的查询保持为 10几ms,而不是缓存生效时通常的个位数甚至 0ms)

root@N1-U20:~# digg -p 66 twitter.com

; <<>> DiG 9.16.1-Ubuntu <<>> -p 66 twitter.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 13798
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;twitter.com.			IN	A

;; ANSWER SECTION:
twitter.com.		192	IN	A	104.244.42.1 [美国 Twitter公司]

;; Query time: 168 msec
;; SERVER: 127.0.0.1 [本机地址]#66(127.0.0.1 [本机地址])
;; WHEN: Wed Dec 30 11:58:53 CST 2020
;; MSG SIZE  rcvd: 67

root@N1-U20:~# digg -p 66 twitter.com

; <<>> DiG 9.16.1-Ubuntu <<>> -p 66 twitter.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25131
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;twitter.com.			IN	A

;; ANSWER SECTION:
twitter.com.		189	IN	A	104.244.42.1 [美国 Twitter公司]

;; Query time: 168 msec
;; SERVER: 127.0.0.1 [本机地址]#66(127.0.0.1 [本机地址])
;; WHEN: Wed Dec 30 11:58:57 CST 2020
;; MSG SIZE  rcvd: 67

如何重现

描述一下如何重现该问题。请尽可能的包含:

mosdns 的版本号(mosdns -v): v0.21.0-0-gcce303d

使用的启动参数或启动方式:mosdns -c /root/cfg/mosdns_s.yaml

操作系统和平台: Linux N1-U20 5.9.0-arm-64 #20.10 SMP PREEMPT Wed Oct 14 12:04:42 MSK 2020 aarch64 aarch64 aarch64 GNU/Linux

进行了什么操作导致了问题的出现:

使用的配置文件:

plugin:
  - tag: log        # 日志
    type: logger 
    args:
      no_color: true
      level: debug

  - tag: main_server    # 启动服务器
    type: server
    args:
      entry: pipeline
      max_concurrent_queries: 0
      server:
        - protocol: udp
          addr: 0.0.0.0:66
        - protocol: tcp
          addr: 0.0.0.0:66

  ################# 可执行插件 ################

  - tag: pipeline
    type: pipeline
    args:
      pipe:
        - _default_cache          # 缓存
        - main_sequence           # 处理请求的主要执行序列

  - tag: main_sequence
    type: sequence
    args:
      exec:
        - if:
            - match_ad_domain       # 处理已知的广告域名
          exec:
            - _block_with_nxdomain  # 屏蔽
          goto: _end

        - if:
            - match_local_domain      # 处理已知的本地域名
            - _query_type_is_unusual  # 和不常见的请求类型
          exec:
            - forward_local
          goto: _end

        - if:
            - match_non_local_domain  # 处理已知的非本地域名
          exec:
            - forward_remote
          goto: _end

        - sequence_bypass_local       # 分流未知域名。有两种方案:顺序或并行。这是顺序执行。
      # - parallel_bypass_local       # 如果想用类似 ChinaDNS 的并发分流逻辑。用这个。

  - tag: sequence_bypass_local        # 顺序执行的分流逻辑
    type: sequence
    args:
      exec:
        - forward_local               # 先请求转发至本地服务器
        - if:
            - match_local_ip          # 如果应答包含本地 IP
          goto: _end                  # 就直接采用结果
        - forward_remote              # 否则用远程服务器的结果

  - tag: parallel_bypass_local        # 并发执行的分流的逻辑
    type: parallel
    args:
      exec:
        - - forward_local             # 并发请求本地和远程服务器
          - if:
              - !match_local_ip       # 本地服务器返回的非本地 IP 的应答会被丢弃
            exec:
              - _drop_response
        - - forward_remote

  - tag: forward_local # 转发至本地服务器的插件
    type: forward
    args:
      upstream:
        - addr: https://223.5.5.5/dns-query

  - tag: forward_remote # 转发至远程服务器的插件
    type: forward
    args:
      upstream:
        - addr: https://1.1.1.1/dns-query

  ################ 匹配器插件 #################

  - tag: match_local_domain   # 匹配本地域名的插件
    type: domain_matcher
    args:
      check_cname: false
      check_question: true
      domain:
        - "/root/cfg/geosite.dat:cn"

  - tag: match_non_local_domain   # 匹配非本地域名的插件
    type: domain_matcher
    args:
      check_cname: false
      check_question: true
      domain:
        - "/root/cfg/geosite.dat:geolocation-!cn"

  - tag: match_local_ip       # 匹配本地 IP的插件
    type: ip_matcher
    args:
      match_client: false
      match_response: true
      ip:
        - "/root/cfg/geoip.dat:cn"

  - tag: match_ad_domain   # 匹配广告域名的插件
    type: domain_matcher
    args:
      check_cname: false
      check_question: true
      domain:
        - "/root/cfg/geosite.dat:category-ads-all"

include: [ ]

[BUG]Macos Big Sur 开发环境运行出现 panic: qtls.ClientHelloInfo doesn't match

出现了什么问题

描述一下问题的表现。可以直接附上截图或log。建议配置logger插件使用debug级别获取更详细的调试log。

- 运行环境 Macos Big Sur
- goland 开发环境, 直接运行main函数时发生崩溃

API server listening at: [::]:59168
debugserver-@(#)PROGRAM:LLDB  PROJECT:lldb-1200.0.44
 for x86_64.
Got a connection, launched process /private/var/folders/zj/6zbq84kd21j4111jws835kwr0000gn/T/___1go_build_github_com_IrineSistiana_mosdns (pid = 89773).
panic: qtls.ClientHelloInfo doesn't match

goroutine 1 [running]:
github.com/marten-seemann/qtls-go1-15.init.0()
        /Users/wjk/go/pkg/mod/github.com/marten-seemann/[email protected]/unsafe.go:20 +0x525
Exiting.

如何重现

直接运行main函数

[BUG] 命令行运行时日志中存在颜色代码

出现了什么问题

log 写入时保留了颜色代码,或者叫做 escape sequence。

�[36mINFO�[0m[0000] loading plugin chinadns_server               

想要输出的格式,没有颜色代码

time="2020-12-27T00:49:50+08:00" level=info msg="loading plugin chinadns_server"
time="2020-12-27T00:49:50+08:00" level=info msg="udp server started at 127.0.0.1:53000" plugin=chinadns_server

前者是通过在终端命令行启动,后者是通过配置 macOS launch daemon 启动。猜测输出内容会根据是否为交互终端而输出颜色代码,而不是根据输出对象是否为文本。


如何重现

mosdns 的版本号(mosdns -v):v0.20.0-0-g41c6960

使用的启动参数或启动方式:mosdns -c config.yaml

操作系统和平台:macOS

使用的配置文件:

plugin:
  - tag: my_logger
    type: logger
    args:
      file: "/usr/local/var/log/mosdns/mosdns.log"
      # file: ""
      level: info
      # level: debug
...

关于静态编译的问题?

目前我个人情况是使用 OpenWrt X86 软路由,发现 mosdns 很好用,已经替换 dnsmasq 了。今天在升级版本的时候发现使用不了,经排查发现是动态链接的问题。

由于 OpenWrt Alpine 这种 Linux 系统采用 MUSL 动态库,所以导致动态链接的最新版本 v1.3.2 无法运行。
以 linux amd64 为例,我看了下包里动态链接的文件有 19M,我自行静态编译的才 15M。

我编译的命令如下:
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X main.version=v1.3.2" -trimpath -o mosdns

[BUG] ext:后的路径文件用引号包围则找不到路径

出现了什么问题

ext:后的文件用引号包围则找不到路径,去掉引号后正常,这样的话如果路径或者文件名包含空格怎么处理?

failed to load file ext:"/root/cfg/geosite.dat:geolocation-!cn": open "/root/cfg/geosite.dat: no such file or directory

如何重现

描述一下如何重现该问题。请尽可能的包含:

mosdns 的版本号(mosdns -v):1.4.0

使用的启动参数或启动方式:

操作系统和平台:Linux

[BUG]mos-chinadns升级至此需要改哪里?

出现了什么问题
mos-chinadns 迭代至此不会用了,请问用原来的luci -app-mos-chinadns壳,换上这里的二进制核心,再用示例.yaml覆盖原来的config,就可以直接替换使用吗?


如何重现

描述一下如何重现该问题。请尽可能的包含:

mosdns 的版本号(mosdns -v):

使用的启动参数或启动方式:

操作系统和平台:

进行了什么操作导致了问题的出现:

使用的配置文件:

[Feature request] hosts插件监控文件改动或提供命令重新加载hosts文件

希望添加的功能
hosts插件能够监控hosts文件的改动,然后自动重新加载hosts文件的配置;
或让mosdns提供一个命令,在不重启mosdns服务的情况下,可以重新加载hosts文件。

请详细描述一下该功能作用和使用场景
像有些用户有修改自定义的域名到动态IP的场景;
例如,我运行了很多docker容器,我有把域名解析到容器IP的需求,但是容器的IP很可能重启后发现了变化, 我有脚本监控容器IP的变化然后将新的IP和预定义的域名写入hosts文件, 这样其他的应用总是可以正常的通过域名访问到容器提供的服务。

[Feature request] socks5支持

希望还是能支持socks5。

看到说明不支持socks5了,建议还是加上。因为在实际使用的场景中,需要走代理线路去解析dns以获得离代理服务器最优的解析结果。

[BUG] 配置 mosdns 对指定范围的双栈域名立即屏蔽 AAAA 解析请求,但并未得到期待的结果

出现了什么问题

配置 mosdns 对指定范围的双栈域名立即屏蔽 AAAA 解析请求,但并未得到期待的结果。
具体来说,因为代理服务器可能不支持 IPv6 环境,但是本地访问一些学术资料时却可能需要用到 IPv6,所以希望配置 mosdns 只对指定范围的域名屏蔽 AAAA 解析请求。

mosdns 的版本号(mosdns -v):
v0.22.1-0-g8c1d997

使用的启动参数或启动方式:
使用发行时压缩包内包含的 winsw XML 配置将 mosdns 安装为系统服务并启动。

进行了什么操作导致了问题的出现
dig +nocookie www.facebook.com @127.0.0.1 AAAA
// 因为 facebook 的首页域名肯定会被 non_local_domain 匹配上,所以预期的结果是不返回结果。但实际上返回了正确的 IPv6 地址。

使用的配置文件(为方便阅读,仅提供节选的配置):

  ################ Executable Plugin (Route) #################

  - tag: main_pipeline           # 分流路由
    type: pipeline
    args:
      pipe:
        - cloak_hosts            # 可以是 pipeline 插件,
        - _default_cache
        - set_ecs                # 功能插件
        - main_sequence          # 路由插件

  - tag: main_sequence
    type: sequence
    args:
      exec:
        - if:
            - query_is_ad_domain
          exec:
            - _block_with_nxdomain
          goto: _end

        - if:
            - query_is_non_local_domain
          exec:
            - forward_nextdns
            - if:
                - match_aaaa
              exec:
                - _drop_response
          goto: _end

        - if:
            - query_is_local_domain
          exec:
            - with_fallback_cn_dns_serv
            - if:
                - response_has_bogus_ip
              exec:
                - _drop_response
          goto: _end

        - forward_nextdns        # 兜底

  ################ Matcher Plugin #################

  - tag: query_is_local_domain        # 匹配本地域名的插件
    type: query_matcher
    args:
      domain:                         # 匹配请求域名的域名表
        - "./geosite.dat:cn"
        - "./geosite.dat:category-scholar-!cn"
        - "./dnsmasq-china-list.txt"

  - tag: query_is_non_local_domain    # 匹配非本地域名的插件
    type: query_matcher
    args:
      domain:
        - "./geosite.dat:geolocation-!cn"
        - "./geosite.dat:google-scholar"

  - tag: query_is_ad_domain           # 匹配广告域名的插件
    type: query_matcher
    args:
      domain:
        - "./geosite.dat:category-ads-all"

  - tag: match_aaaa
    type: query_matcher
    args:
      qtype: [28]

  - tag: response_has_bogus_ip
    type: response_matcher
    args:
      ip:
        - "./bogus-nxdomain.china.ip.txt"

cache 插件存在 bug

在针对最新版本推出的功能进行对应配置以后,我遇到了可以正常启动程序,但是在接收到 DNS 请求后程序无法顺利处理并退出的问题。
以下是报错信息:

time="2020-12-24T15:29:13+08:00" level=info msg="mosdns ver: v0.18.0-0-g5ca1a5e"
time="2020-12-24T15:29:13+08:00" level=info msg="arch: amd64, os: windows, go: go1.15.6"
time="2020-12-24T15:29:13+08:00" level=info msg="loading config file: config.yaml"
time="2020-12-24T15:29:13+08:00" level=info msg="loading plugin my_logger"
time="2020-12-24T15:29:13+08:00" level=warning msg="[{ts.eset.com. 1 1}], id: 10135, t: 0 ms, from: udp://[::1]:60445: entry route_ingress returned with err: plugin route_ingress reported an err: plugin exec_preprocessing_route reported an err: plugin exec_preprocessing_route reported an err: plugin tag match_ad_domain not defined" plugin=my_plain_server
time="2020-12-24T15:29:13+08:00" level=warning msg="[{ts.eset.com. 28 1}], id: 63752, t: 0 ms, from: udp://[::1]:56027: entry route_ingress returned with err: plugin route_ingress reported an err: plugin exec_preprocessing_route reported an err: plugin exec_preprocessing_route reported an err: plugin tag match_ad_domain not defined" plugin=my_plain_server
time="2020-12-24T15:29:13+08:00" level=warning msg="[{ts.eset.com. 1 1}], id: 10135, t: 0 ms, from: udp://127.0.0.1:60445: entry route_ingress returned with err: plugin route_ingress reported an err: plugin exec_preprocessing_route reported an err: plugin exec_preprocessing_route reported an err: plugin tag match_ad_domain not defined" plugin=my_plain_server
time="2020-12-24T15:29:13+08:00" level=warning msg="[{ts.eset.com. 28 1}], id: 63752, t: 0 ms, from: udp://127.0.0.1:56027: entry route_ingress returned with err: plugin route_ingress reported an err: plugin exec_preprocessing_route reported an err: plugin exec_preprocessing_route reported an err: plugin tag match_ad_domain not defined" plugin=my_plain_server
panic: runtime error: index out of range [0] with length 0

goroutine 39 [running]:
github.com/IrineSistiana/mosdns/dispatcher/plugin/pipeline/cache.getMinimalTTL(0xc000162360, 0xd216c0)
        github.com/IrineSistiana/mosdns/dispatcher/plugin/pipeline/cache/cache.go:157 +0x1c5
github.com/IrineSistiana/mosdns/dispatcher/plugin/pipeline/cache.(*cachePipeLine).Connect(0xc0001660a0, 0xd216c0, 0xc001008000, 0xc000038040, 0xc000038480, 0x2, 0x2)
        github.com/IrineSistiana/mosdns/dispatcher/plugin/pipeline/cache/plugin.go:89 +0xeb
github.com/IrineSistiana/mosdns/dispatcher/handler.(*PipeContext).ExecNextPlugin(0xc000038480, 0xd216c0, 0xc001008000, 0xc000038040, 0xc0002cf630, 0x1)
        github.com/IrineSistiana/mosdns/dispatcher/handler/pipeline_plugin.go:56 +0x5ed
github.com/IrineSistiana/mosdns/dispatcher/plugin/router/pipeline.(*pipelineRouter).Do(0xc000005d20, 0xd216c0, 0xc001008000, 0xc000038040, 0xc000005d20, 0x0, 0x0, 0x0)
        github.com/IrineSistiana/mosdns/dispatcher/plugin/router/pipeline/pipeline.go:76 +0xf3
github.com/IrineSistiana/mosdns/dispatcher/handler.Walk(0xd216c0, 0xc001008000, 0xc000038040, 0xc00002a6c0, 0xd, 0xc001008000, 0xd21640)
        github.com/IrineSistiana/mosdns/dispatcher/handler/router_plugin.go:54 +0x1e9
github.com/IrineSistiana/mosdns/dispatcher/handler.(*DefaultServerHandler).ServeDNS(0xc0000057a0, 0xd216c0, 0xc001008000, 0xc000038040, 0xd11300, 0xc00374e080)
        github.com/IrineSistiana/mosdns/dispatcher/handler/server.go:45 +0x7a
github.com/IrineSistiana/mosdns/dispatcher/plugin/plain_server.(*singleServer).serveUDP.func1(0xd21640, 0xc000300080, 0xd11020, 0xc0000057a0, 0xc000038040, 0xc00374e080)
        github.com/IrineSistiana/mosdns/dispatcher/plugin/plain_server/udp.go:83 +0xbc
created by github.com/IrineSistiana/mosdns/dispatcher/plugin/plain_server.(*singleServer).serveUDP
        github.com/IrineSistiana/mosdns/dispatcher/plugin/plain_server/udp.go:80 +0x258

配置文件的结构如下:

route_ingress (sequence)  ---【执行 exec_preprocessing_route (sequence)】--->  sequence 执行完成,进入下一条路由
---> route_pipeline_main (pipeline) 

pipeline 内容如下:
  - _default_cache
  - set_ecs (function plugin)
  - bypass_local (sequence)
  - default_route (sequence)

我在配置时推断了很久的地方在于:如何在 pipeline 路由中添加类似 sequence 路由里的条件判断。
如果希望缓存请求应答,那么看起来有必要将处理请求的全部环节都放在 pipeline 路由中。但是同时我希望做到对国内域名和国外域名分别请求,Wiki 里没有见到支持 if 这样的语法,所以我就尝试着把 sequence 路由放在 pipeline 路由里执行了。

完整的配置文件如下,希望能帮忙指点哪里有问题。


plugin:
  - tag: my_logger
    type: logger
    args:
      file: "./mosdns.log"
      level: warn
  - tag: my_plain_server
    type: plain_server
    args:
      entry: route_ingress
      listen:
        - udp://127.0.0.1:53
        - tcp://127.0.0.1:53
        - udp://[::1]:53
        - tcp://[::1]:53

  ################ 路由插件 #################

  - tag: exec_preprocessing_route
    type: sequence
    args:
      exec:
        - if:
            - match_hosts
          goto: _end
        - if:
            - match_ad_domain
          exec:
            - _block_with_nxdomain
          goto: _end
      next: ""

  - tag: route_ingress
    type: sequence
    args:
      exec:
        - exec_preprocessing_route
      next: "route_pipeline_main"

  - tag: route_pipeline_main        # 分流路由
    type: pipeline
    args:
      pipe: 
        - _default_cache            # 可以是 pipeline 插件,
        - set_ecs                   # 功能插件
        - bypass_local              # 路由插件
        - default_route
      next: "" # 下一个路由插件。

  - tag: bypass_local
    type: sequence
    args:
      exec:
        - if:
            - match_local_domain
          exec:
            - fallback_local
          goto: _end

      next: ""

  - tag: default_route
    type: sequence
    args:
      exec:
        - forward_cf
      next: ""

  ################ 匹配器插件 #################

  - tag: match_hosts
    type: hosts
    args:
      hosts: # hosts 文件。可配置多个。至少要配置一个。
        - ./mosdns-hosts.txt

  - tag: match_ad_domain   # 匹配广告域名
    type: domain_matcher
    args:
      check_cname: true
      check_question: true
      domain:
        - "./geosite.dat:category-ads-all"

  - tag: match_local_domain   # 匹配本地域名
    type: domain_matcher
    args:
      check_cname: true
      check_question: true
      domain:
        - "./geosite.dat:cn"

  - tag: match_non_local_domain   # 匹配非本地域名
    type: domain_matcher
    args:
      check_cname: true
      check_question: true
      domain:
        - "./geosite.dat:geolocation-!cn"

  ################# 功能性插件 ################

  - tag: set_ecs
    type: ecs
    args:
      auto: false # 是否自动将客户端地址作为 ECS 附加到请求。如果为 true,则预设地址不会被使用。
      force_overwrite: false  # 如果请求已有 ECS,是否覆盖。
      mask4: 24               # 用于 ipv4 地址的掩码。
      mask6: 32               # 用于 ipv6 地址的掩码。
      ipv4: "223.6.6.6:53"   # 预设的 ipv4 地址。如果非空,会附加在 A 请求中。
      ipv6: "2001:da8:223:5555:5555:5555:5555:5555"  # 预设的 ipv6 地址。如果非空,会附加在 AAAA 请求中。

  - tag: fallback_local
    type: fallback
    args:
      primary:            # 主要运行序列。可以是功能插件,路由插件。
        - set_ecs
        - forward_tuna_moe
      secondary:          # 次要运行序列。同上。
        - _no_ecs
        - fallback_with_plain_request
      stat_length: 10     # 统计长度。默认 10。
      threshold: 5        # 触发阈值。不可大于统计长度。默认 5。

  - tag: fallback_with_plain_request
    type: fast_forward
    args:
      upstream: # 上游服务器地址。至少要配置一个。如果配置了多个上游服务器,会同时请求,然后取最快返回的应答。
        - udp://223.5.5.5:53
        - udp://223.6.6.6:53

  - tag: forward_tuna_moe
    type: forward
    args:
      upstream:
        - addr: https://101.6.6.6:8443/resolve
      deduplicate: true
      insecure_skip_verify: false
      timeout: 10

  - tag: forward_cf # 转发至远程服务器
    type: forward
    args:
      upstream: # 上游服务器。可配置多个。至少要配置一个。
        - addr: https://1.0.0.1/dns-query
      deduplicate: true # 是否请求去重。
      insecure_skip_verify: false # 禁用 TLS 身份验证。
      timeout: 10 # 超时时间,单位: 秒。

ipset的黑白名单

有没可能实现local的查询结果写入一个白名单ipset, remote的查询结果写入一个黑名单ipset,这样用于iptable分流更有意义。
如果黑白域名都写入一个ipset, 我没想到该如何有效利用.

[BUG] 0.22 fast_forward 问题

出现了什么问题

parallel 模式配合 fast_forward 上游,如用 dig 或者 kdig 测试,在任意域名第二次查询时报错超时: ;; Warning: ID mismatch:
nslookup 无问题!
不用 fast_forward 做上游无问题!

mosdns 日志:

time="2020-12-31T21:38:55+08:00" level=debug msg="cpool cleaner 0x40002c9800 exited" func="github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/fast_forward/cpool.(*Pool).startCleaner" file="github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/fast_forward/cpool/pool.go:149" addr="8.8.8.8:853" plugin=fast_forward_remote protocol=tcp
time="2020-12-31T21:39:05+08:00" level=debug msg="[{wsj.com. 1 1}], id: 13237, t: 0 ms, from: udp://192.168.2.8:62659: exec context plugin _default_cache" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*PipeContext).ExecNextPlugin" file="github.com/IrineSistiana/mosdns/dispatcher/handler/context_plugin.go:54" plugin=pipeline_parallel
time="2020-12-31T21:39:05+08:00" level=debug msg="[{wsj.com. 1 1}], id: 13237, t: 0 ms, from: udp://192.168.2.8:62659: exec executable plugin main_parallel" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*PipeContext).ExecNextPlugin" file="github.com/IrineSistiana/mosdns/dispatcher/handler/context_plugin.go:57" plugin=pipeline_parallel
time="2020-12-31T21:39:05+08:00" level=debug msg="[{wsj.com. 1 1}], id: 13237, t: 1 ms, from: udp://192.168.2.8:62659: exec matcher plugin match_local_domain, returned: false" func=github.com/IrineSistiana/mosdns/dispatcher/handler.ifConditionfile="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:153" plugin=main_parallel
time="2020-12-31T21:39:05+08:00" level=debug msg="[{wsj.com. 1 1}], id: 13237, t: 1 ms, from: udp://192.168.2.8:62659: exec matcher plugin match_non_local_domain, returned: true" func=github.com/IrineSistiana/mosdns/dispatcher/handler.ifCondition file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:153" plugin=main_parallel
time="2020-12-31T21:39:05+08:00" level=debug msg="[{wsj.com. 1 1}], id: 13237, t: 2 ms, from: udp://192.168.2.8:62659: exec plugin ecs_remote" func=github.com/IrineSistiana/mosdns/dispatcher/handler.executablePluginTag.ExecCmd file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:72" plugin=main_parallel
time="2020-12-31T21:39:05+08:00" level=debug msg="[{wsj.com. 1 1}], id: 13237, t: 2 ms, from: udp://192.168.2.8:62659: exec plugin fast_forward_remote" func=github.com/IrineSistiana/mosdns/dispatcher/handler.executablePluginTag.ExecCmd file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:72" plugin=main_parallel
time="2020-12-31T21:39:05+08:00" level=debug msg="[{wsj.com. 1 1}], id: 13237, t: 199 ms, from: udp://192.168.2.8:62659: goto plugin _end" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*ExecutableCmdSequence).Exec" file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:237" plugin=main_parallel
time="2020-12-31T21:39:05+08:00" level=debug msg="cpool cleaner 0x40002c9800 started" func="github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/fast_forward/cpool.(*Pool).startCleaner" file="github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/fast_forward/cpool/pool.go:136" addr="8.8.8.8:853" plugin=fast_forward_remote protocol=tcp
time="2020-12-31T21:39:06+08:00" level=debug msg="cpool cleaner 0x40002c9740 started" func="github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/fast_forward/cpool.(*Pool).startCleaner" file="github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/fast_forward/cpool/pool.go:136" addr="9.9.9.11:853" plugin=fast_forward_remote protocol=tcp
time="2020-12-31T21:39:09+08:00" level=debug msg="HeapObjects: 30225 NumGC: 14 PauseTotalNs: 2824826, NumGoroutine: 13" func=github.com/IrineSistiana/mosdns/dispatcher/plugin/logger.configLogger.func1 file="github.com/IrineSistiana/mosdns/dispatcher/plugin/logger/logger.go:117"
time="2020-12-31T21:39:10+08:00" level=debug msg="[{wsj.com. 1 1}], id: 13237, t: 0 ms, from: udp://192.168.2.8:62659: exec context plugin _default_cache" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*PipeContext).ExecNextPlugin" file="github.com/IrineSistiana/mosdns/dispatcher/handler/context_plugin.go:54" plugin=pipeline_parallel
time="2020-12-31T21:39:10+08:00" level=debug msg="[{wsj.com. 1 1}], id: 13237, t: 0 ms, from: udp://192.168.2.8:62659: exec executable plugin main_parallel" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*PipeContext).ExecNextPlugin" file="github.com/IrineSistiana/mosdns/dispatcher/handler/context_plugin.go:57" plugin=pipeline_parallel
time="2020-12-31T21:39:10+08:00" level=debug msg="[{wsj.com. 1 1}], id: 13237, t: 1 ms, from: udp://192.168.2.8:62659: exec matcher plugin match_local_domain, returned: false" func=github.com/IrineSistiana/mosdns/dispatcher/handler.ifConditionfile="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:153" plugin=main_parallel
time="2020-12-31T21:39:10+08:00" level=debug msg="[{wsj.com. 1 1}], id: 13237, t: 1 ms, from: udp://192.168.2.8:62659: exec matcher plugin match_non_local_domain, returned: true" func=github.com/IrineSistiana/mosdns/dispatcher/handler.ifCondition file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:153" plugin=main_parallel
time="2020-12-31T21:39:10+08:00" level=debug msg="[{wsj.com. 1 1}], id: 13237, t: 2 ms, from: udp://192.168.2.8:62659: exec plugin ecs_remote" func=github.com/IrineSistiana/mosdns/dispatcher/handler.executablePluginTag.ExecCmd file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:72" plugin=main_parallel
time="2020-12-31T21:39:10+08:00" level=debug msg="[{wsj.com. 1 1}], id: 13237, t: 2 ms, from: udp://192.168.2.8:62659: exec plugin fast_forward_remote" func=github.com/IrineSistiana/mosdns/dispatcher/handler.executablePluginTag.ExecCmd file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:72" plugin=main_parallel
time="2020-12-31T21:39:10+08:00" level=debug msg="[{wsj.com. 1 1}], id: 13237, t: 3 ms, from: udp://192.168.2.8:62659: goto plugin _end" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*ExecutableCmdSequence).Exec" file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:237" plugin=main_parallel
time="2020-12-31T21:39:15+08:00" level=debug msg="[{wsj.com. 1 1}], id: 13237, t: 0 ms, from: udp://192.168.2.8:62659: exec context plugin _default_cache" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*PipeContext).ExecNextPlugin" file="github.com/IrineSistiana/mosdns/dispatcher/handler/context_plugin.go:54" plugin=pipeline_parallel
time="2020-12-31T21:39:15+08:00" level=debug msg="[{wsj.com. 1 1}], id: 13237, t: 0 ms, from: udp://192.168.2.8:62659: exec executable plugin main_parallel" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*PipeContext).ExecNextPlugin" file="github.com/IrineSistiana/mosdns/dispatcher/handler/context_plugin.go:57" plugin=pipeline_parallel
time="2020-12-31T21:39:15+08:00" level=debug msg="[{wsj.com. 1 1}], id: 13237, t: 1 ms, from: udp://192.168.2.8:62659: exec matcher plugin match_local_domain, returned: false" func=github.com/IrineSistiana/mosdns/dispatcher/handler.ifConditionfile="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:153" plugin=main_parallel
time="2020-12-31T21:39:15+08:00" level=debug msg="[{wsj.com. 1 1}], id: 13237, t: 1 ms, from: udp://192.168.2.8:62659: exec matcher plugin match_non_local_domain, returned: true" func=github.com/IrineSistiana/mosdns/dispatcher/handler.ifCondition file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:153" plugin=main_parallel
time="2020-12-31T21:39:15+08:00" level=debug msg="[{wsj.com. 1 1}], id: 13237, t: 2 ms, from: udp://192.168.2.8:62659: exec plugin ecs_remote" func=github.com/IrineSistiana/mosdns/dispatcher/handler.executablePluginTag.ExecCmd file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:72" plugin=main_parallel
time="2020-12-31T21:39:15+08:00" level=debug msg="[{wsj.com. 1 1}], id: 13237, t: 2 ms, from: udp://192.168.2.8:62659: exec plugin fast_forward_remote" func=github.com/IrineSistiana/mosdns/dispatcher/handler.executablePluginTag.ExecCmd file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:72" plugin=main_parallel
time="2020-12-31T21:39:15+08:00" level=debug msg="[{wsj.com. 1 1}], id: 13237, t: 4 ms, from: udp://192.168.2.8:62659: goto plugin _end" func="github.com/IrineSistiana/mosdns/dispatcher/handler.(*ExecutableCmdSequence).Exec" file="github.com/IrineSistiana/mosdns/dispatcher/handler/executable_plugin.go:237" plugin=main_parallel

同时查询窗口:

dig @192.168.2.20 -p 66 wsj.com +nocookie
;; Warning: ID mismatch: expected ID 13237, got 43271
;; Warning: ID mismatch: expected ID 13237, got 43271
;; Warning: ID mismatch: expected ID 13237, got 3305

; <<>> DiG 9.17.6 <<>> @192.168.2.20 -p 66 wsj.com +nocookie
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached

如何重现

描述一下如何重现该问题。请尽可能的包含:

mosdns 的版本号(mosdns -v): v0.22.0-0-g5fdab3e

使用的启动参数或启动方式:mosdns -c mosdns.yaml

操作系统和平台:Linux N1-U20 5.9.0-arm-64 #20.10 SMP PREEMPT Wed Oct 14 12:04:42 MSK 2020 aarch64 aarch64 aarch64 GNU/Linux

进行了什么操作导致了问题的出现:

使用的配置文件:(由于想测试所有功能所以配置写的比较复杂>_<)

plugin:
  ## 日志
  - tag: logger
    type: logger
    args:
      no_color: true
      # file: "/var/log/mosdns.log"
      # level: info
      file: ""
      level: debug

  ## 启动 sequence 服务器
  - tag: sequence_server
    type: server
    args:
      max_concurrent_queries: 0
      entry: pipeline_sequence
      server:
        - protocol: udp
          addr: 0.0.0.0:64
        - protocol: tcp
          addr: 0.0.0.0:64

  ## 启动 parallel 服务器
  - tag: parallel_server
    type: server
    args:
      max_concurrent_queries: 0
      entry: pipeline_parallel
      server:
        - protocol: udp
          addr: 0.0.0.0:66
        - protocol: tcp
          addr: 0.0.0.0:66

  ## 可执行插件-顺序
  - tag: pipeline_sequence
    type: pipeline
    args:
      pipe:
        - _default_cache          # 缓存
        - main_sequence           # 处理请求

  - tag: main_sequence
    type: sequence
    args:
      exec:
        - if:
            - match_local_domain      # 处理已知的本地域名
            - !_query_is_common  # 和不常见的请求类型
          exec:
            - ecs_local
            - forward_local
          goto: _end

        - if:
            - match_non_local_domain  # 处理已知的非本地域名
          exec:
            - ecs_remote
            - forward_remote
          goto: _end

        - sequence_bypass_local       # 分流未知域名。有两种方案:顺序或并行。这是顺序执行。

  ## 可执行插件-并发
  - tag: pipeline_parallel
    type: pipeline
    args:
      pipe:
        - _default_cache          # 缓存
        - main_parallel           # 处理请求

  - tag: main_parallel
    type: sequence
    args:
      exec:
        - if:
            - match_local_domain      # 处理已知的本地域名
            - !_query_is_common  # 和不常见的请求类型
          exec:
            - ecs_local
            - fast_forward_local
          goto: _end

        - if:
            - match_non_local_domain  # 处理已知的非本地域名
          exec:
            - ecs_remote
            - fast_forward_remote
          goto: _end

        - parallel_bypass_local       # 分流未知域名。有两种方案:顺序或并行。这是并发执行。

  ## 两种分流逻辑
  - tag: sequence_bypass_local        # 顺序执行的分流逻辑
    type: sequence
    args:
      exec:
        - forward_local               # 先请求转发至本地服务器
        - if:
            - match_local_ip          # 如果应答包含本地 IP
          goto: _end                  # 就直接采用结果
        - forward_remote              # 否则用远程服务器的结果

  - tag: parallel_bypass_local        # 并发执行的分流的逻辑
    type: parallel
    args:
      exec:
        - - fast_forward_local             # 并发请求本地和远程服务器
          - if:
              - !match_local_ip       # 本地服务器返回的非本地 IP 的应答会被丢弃
            exec:
              - _drop_response
        - - fast_forward_remote

  ## 匹配器插件
  # - tag: match_qtype_HTTPS # 匹配 HTTPS 请求
  #   type: query_matcher
  #   args:
  #     type: [65]

  - tag: match_local_domain # 匹配请求域名是否是本地域名
    type: query_matcher
    args:
      domain:
        - "/root/cfg/geosite.dat:cn"

  - tag: match_non_local_domain # 匹配请求域名是否是境外域名
    type: query_matcher
    args:
      domain:
        - "/root/cfg/geosite.dat:geolocation-!cn"

  - tag: match_local_ip # 匹配应答的 IP 是否是本地 IP
    type: response_matcher
    args:
      ip:
        - "/root/cfg/geoip.dat:cn"

  ## ECS
  - tag: ecs_local
    type: ecs
    args:
      auto: false # 是否根据客户端地址自动附加 ECS。如果为 true,则预设地址不会被使用。
      force_overwrite: false  # 如果请求已有 ECS,是否覆盖。
      mask4: 24               # 用于 ipv4 地址的掩码。
      mask6: 32               # 用于 ipv6 地址的掩码。
      ipv4: "120.230.137.0"         # 预设的 ipv4 地址。如果非空,会附加在 A 请求中。
      ipv6: ""   # 预设的 ipv6 地址。如果非空,会附加在 AAAA 请求中。

  - tag: ecs_remote
    type: ecs
    args:
      auto: false
      force_overwrite: false
      mask4: 24
      mask6: 32
      ipv4: "202.67.222.0"
      ipv6: ""

  ## 功能性插件
  - tag: forward_local # 转发至本地服务器
    type: forward
    args:
      upstream:
        - addr: 211.136.192.6:53
        - addr: 120.196.165.24:53
        - addr: https://doh.360.cn/dns-query
        - addr: https://i.233py.com/dns-query
        - addr: tls://dns.alidns.com
        - addr: tls://dns.pub
      deduplicate: false           # 是否请求去重。
      insecure_skip_verify: false  # 禁用 TLS 身份验证。
      timeout: 6                  # 超时时间,单位: 秒。
      # 用于解析上游服务器域名的 bootstrap 服务器地址。可配置多个。必须没有域名。可以为空,会使用系统设置。
      bootstrap:
        - 9.9.9.9:9953
        - 208.67.220.220:443

  - tag: forward_remote # 转发至远程服务器
    type: forward
    args:
      upstream:
        - addr: https://dns11.quad9.net/dns-query
        - addr: https://dns.twnic.tw/dns-query
        - addr: tls://dns.google
        - addr: tls://dns.sb
      deduplicate: false
      insecure_skip_verify: false
      timeout: 6
      bootstrap:
        - 9.9.9.9:9953
        - 208.67.220.220:443

  - tag: fast_forward_local
    type: fast_forward
    args:
      deduplicate: false    # 是否请求去重。
      upstream:             # 上游服务器。至少要配置一个。可配置多个,会并发请求全部服务器。
        - protocol: dot     # 服务器协议。可以是 `udp`, `tcp`, `dot`, `doh`。为空默认 `udp`。
          addr: 223.5.5.5:853  # 服务器地址。不可为空。格式 `host:port`。`:port` 可省略。
          trusted: false     # 是否是可信服务器。仅配置了多个服务器时生效。
                            # true: 该服务器返回的 Rcode != 0 的应答会被接受。
                            # false: 该服务器返回的 Rcode != 0 会被丢弃。
          socks5: ""  # socks5 服务器地址。格式 `host:port`。`:port` 不可省略。
                      # 不支持用户名密码认证。适用于 `tcp`, `dot`, `doh` 协议。
          server_name: dns.alidns.com           # 服务器(证书)名。适用于 `dot` 协议。不可为空。
          url: https://dns.alidns.com/dns-query # 服务器 URL。适用于 `doh` 协议。不可为空。
          timeout: 5          # 应答超时时间。单位: 秒。默认 5。适用于全部协议。
          idle_timeout: 10    # 空连接超时时间。单位: 秒。
                              # 如果为 0,则禁用连接重用(对于 `udp` 协议是禁用套接字重用)。适用于全部协议。
          insecure_skip_verify: false # 是否禁用 TLS 验证。适用于 `dot`,`doh` 协议。
          ca: [ ]             # 用于 TLS 验证的 CA 证书。适用于 `dot`,`doh` 协议。为空默认使用系统证书。

        - protocol: dot
          addr: 162.14.21.56:853
          trusted: false
          socks5: ""
          server_name: dns.pub
          url: https://dns.pub/dns-query
          timeout: 5
          idle_timeout: 10
          insecure_skip_verify: false
          ca: [ ]

  - tag: fast_forward_remote
    type: fast_forward
    args:
      deduplicate: false    # 是否请求去重。
      upstream:             # 上游服务器。至少要配置一个。可配置多个,会并发请求全部服务器。
        - protocol: dot     # 服务器协议。可以是 `udp`, `tcp`, `dot`, `doh`。为空默认 `udp`。
          addr: 9.9.9.11:853  # 服务器地址。不可为空。格式 `host:port`。`:port` 可省略。
          trusted: true     # 是否是可信服务器。仅配置了多个服务器时生效。
                            # true: 该服务器返回的 Rcode != 0 的应答会被接受。
                            # false: 该服务器返回的 Rcode != 0 会被丢弃。
          socks5: ""  # socks5 服务器地址。格式 `host:port`。`:port` 不可省略。
                      # 不支持用户名密码认证。适用于 `tcp`, `dot`, `doh` 协议。
          server_name: dns11.quad9.net           # 服务器(证书)名。适用于 `dot` 协议。不可为空。
          url: https://dns11.quad9.net/dns-query # 服务器 URL。适用于 `doh` 协议。不可为空。
          timeout: 5          # 应答超时时间。单位: 秒。默认 5。适用于全部协议。
          idle_timeout: 10    # 空连接超时时间。单位: 秒。
                              # 如果为 0,则禁用连接重用(对于 `udp` 协议是禁用套接字重用)。适用于全部协议。
          insecure_skip_verify: false # 是否禁用 TLS 验证。适用于 `dot`,`doh` 协议。
          ca: [ ]             # 用于 TLS 验证的 CA 证书。适用于 `dot`,`doh` 协议。为空默认使用系统证书。

        - protocol: dot
          addr: 8.8.8.8:853
          trusted: true
          socks5: "127.0.0.1:7575"
          server_name: dns.google
          url: https://dns.google/dns-query
          timeout: 5
          idle_timeout: 10
          insecure_skip_verify: false
          ca: [ ]
          

[BUG] ecs 是否可以排除特定地址作为子网,如 127.0.0.1/xx

出现了什么问题

通过本地 dig 测试发现,127.0.0.1/24 子网被设置为 EDNS client subnet,导致域名解析失败。

dig @127.0.0.1 -p 53001 i2.hdslb.com
❯ dig @127.0.0.1 -p 53001 i2.hdslb.com

; <<>> DiG 9.16.9 <<>> @127.0.0.1 -p 53001 i2.hdslb.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 3882
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
; CLIENT-SUBNET: 127.0.0.0/24/24
;; QUESTION SECTION:
;i2.hdslb.com.                  IN      A

;; ANSWER SECTION:
i2.hdslb.com.           452     IN      CNAME   img.hdslb.com.
img.hdslb.com.          152     IN      CNAME   i0.hdslb.com.cdn20.com.

;; Query time: 14 msec
;; SERVER: 127.0.0.1#53001(127.0.0.1)
;; WHEN: Wed Dec 16 16:22:41 CST 2020
;; MSG SIZE  rcvd: 223

;; Query time: 14 msec
;; SERVER: 127.0.0.1#53001(127.0.0.1)
;; WHEN: Wed Dec 16 16:22:41 CST 2020
;; MSG SIZE  rcvd: 223

是不是可以在插件 ecs 排除部分地址?


如何重现

描述一下如何重现该问题。请尽可能的包含:

mosdns 的版本号(mosdns -v):v0.16.0-0-gbe90c3f

使用的启动参数或启动方式:

操作系统和平台:masOS

进行了什么操作导致了问题的出现:

使用的配置文件:

plugin:
  - tag: my_logger
    type: logger
    args:
      file: ""
      level: info
      # level: debug

  - tag: domestic_server
    type: plain_server
    args:
      entry: domestic_sequence
      listen:
        - udp://127.0.0.1:53001
        - tcp://127.0.0.1:53001

  - tag: domestic_sequence
    type: sequence
    args:
      exec:
        # - add_ecs  # may wrongly add 127.0.0.1/24
        # - _no_ecs
        - forward_dnspod
      next: ""

  - tag: forward_dnspod
    type: forward
    args:
      bootstrap:
        - tls://223.5.5.5
      deduplicate: false
      insecure_skip_verify: false
      timeout: 2
      upstream:
        - addr: tls://dns.pub

  - tag: add_ecs
    type: ecs
    args:
      auto: true # 是否自动将客户端地址作为 ECS 附加到请求。如果为 true,则预设地址不会被使用。
      force_overwrite: false  # 如果请求已有 ECS,是否覆盖。
      mask4: 24               # 用于 ipv4 地址的掩码。
      mask6: 32               # 用于 ipv6 地址的掩码。
      # ipv4: "1.2.3.4"         # 预设的 ipv4 地址。如果非空,会附加在 A 请求中。
      # ipv6: "2001:dd8:1a::"   # 预设的 ipv6 地址。如果非空,会附加在 AAAA 请求中。

include: []

[BUG]OpenWrt 服务脚本不能启动程序

出现了什么问题

mosdns-init-openwrt#L15 中多加了 -quiet 参数导致程序没能启动。

# /usr/bin/mosdns -dir /etc/mosdns/ -c ./config.yaml -quiet
flag provided but not defined: -quiet
Usage of /usr/bin/mosdns:
  -bench-domain-list string
        [path] benchmark domain search using this file
  -bench-ip-list string
        [path] benchmark ip search using this file
  -c string
        [path] load config from file (default "config.yaml")
  -cpu int
        the maximum number of CPUs that can be executing simultaneously (default 4)
  -dir string
        [path] change working directory to here
  -dir2exe
        change working directory to the executable that started the current process
  -gen string
        [path] generate a config template here
  -pprof string
        [ip:port] DEBUG ONLY, hook http/pprof at this address
  -probe-dot-timeout string
        [ip:port] probe dot server's idle timeout
  -probe-tcp-timeout string
        [ip:port] probe tcp server's idle timeout
  -v    show version info

[BUG] 出现大量报错信息 context deadline exceeded

#9
运行一段时间后,出现大量报错信息,因为是夜里,不知道是否还能正常使用

Thu Dec 10 04:08:07 2020 daemon.err mosdns[3586]: time="2020-12-09T20:08:07Z" level=warning msg="[{www.qq.com. 1 1}], from: 127.0.0.1:37672: query failed: context deadline exceeded"
Thu Dec 10 04:19:09 2020 daemon.err mosdns[3586]: time="2020-12-09T20:19:09Z" level=warning msg="[{www.baidu.com. 1 1}], from: 127.0.0.1:43115: query failed: context deadline exceeded"
Thu Dec 10 04:19:19 2020 daemon.err mosdns[3586]: time="2020-12-09T20:19:19Z" level=warning msg="[{www.baidu.com. 1 1}], from: 127.0.0.1:43115: query failed: context deadline exceeded"
Thu Dec 10 04:19:29 2020 daemon.err mosdns[3586]: time="2020-12-09T20:19:29Z" level=warning msg="[{www.baidu.com. 1 1}], from: 127.0.0.1:19797: query failed: context deadline exceeded"
Thu Dec 10 04:19:29 2020 daemon.err mosdns[3586]: time="2020-12-09T20:19:29Z" level=warning msg="[{www.baidu.com. 1 1}], from: 127.0.0.1:33199: query failed: context deadline exceeded"
Thu Dec 10 04:19:29 2020 daemon.err mosdns[3586]: time="2020-12-09T20:19:29Z" level=warning msg="[{www.taobao.com. 1 1}], from: 127.0.0.1:25641: query failed: context deadline exceeded"
Thu Dec 10 04:19:39 2020 daemon.err mosdns[3586]: time="2020-12-09T20:19:39Z" level=warning msg="[{www.taobao.com. 1 1}], from: 127.0.0.1:38964: query failed: context deadline exceeded"
Thu Dec 10 04:19:39 2020 daemon.err mosdns[3586]: time="2020-12-09T20:19:39Z" level=warning msg="[{www.taobao.com. 1 1}], from: 127.0.0.1:53601: query failed: context deadline exceeded"
Thu Dec 10 04:19:39 2020 daemon.err mosdns[3586]: time="2020-12-09T20:19:39Z" level=warning msg="[{www.baidu.com. 1 1}], from: 127.0.0.1:33199: query failed: context deadline exceeded"
Thu Dec 10 04:19:49 2020 daemon.err mosdns[3586]: time="2020-12-09T20:19:49Z" level=warning msg="[{www.qq.com. 1 1}], from: 127.0.0.1:38838: query failed: context deadline exceeded"
Thu Dec 10 04:19:49 2020 daemon.err mosdns[3586]: time="2020-12-09T20:19:49Z" level=warning msg="[{www.qq.com. 1 1}], from: 127.0.0.1:54661: query failed: context deadline exceeded"
Thu Dec 10 04:19:49 2020 daemon.err mosdns[3586]: time="2020-12-09T20:19:49Z" level=warning msg="[{www.taobao.com. 1 1}], from: 127.0.0.1:53601: query failed: context deadline exceeded"
Thu Dec 10 04:19:49 2020 daemon.err mosdns[3586]: time="2020-12-09T20:19:49Z" level=warning msg="[{www.taobao.com. 1 1}], from: 127.0.0.1:38964: query failed: context deadline exceeded"
Thu Dec 10 04:19:59 2020 daemon.err mosdns[3586]: time="2020-12-09T20:19:59Z" level=warning msg="[{www.target.com. 28 1}], from: 127.0.0.1:34873: query failed: plugin default reports an err: context deadline exceeded"
Thu Dec 10 04:19:59 2020 daemon.err mosdns[3586]: time="2020-12-09T20:19:59Z" level=warning msg="[{www.target.com. 1 1}], from: 127.0.0.1:30328: query failed: plugin default reports an err: context deadline exceeded"
Thu Dec 10 04:19:59 2020 daemon.err mosdns[3586]: time="2020-12-09T20:19:59Z" level=warning msg="[{www.qq.com. 1 1}], from: 127.0.0.1:21465: query failed: context deadline exceeded"
Thu Dec 10 04:19:59 2020 daemon.err mosdns[3586]: time="2020-12-09T20:19:59Z" level=warning msg="[{www.target.com. 28 1}], from: 127.0.0.1:34873: query failed: plugin default reports an err: context deadline exceeded"
Thu Dec 10 04:19:59 2020 daemon.err mosdns[3586]: time="2020-12-09T20:19:59Z" level=warning msg="[{www.target.com. 1 1}], from: 127.0.0.1:30328: query failed: plugin default reports an err: context deadline exceeded"
Thu Dec 10 04:19:59 2020 daemon.err mosdns[3586]: time="2020-12-09T20:19:59Z" level=warning msg="[{www.baidu.com. 1 1}], from: 127.0.0.1:63338: query failed: context deadline exceeded"
Thu Dec 10 04:19:59 2020 daemon.err mosdns[3586]: time="2020-12-09T20:19:59Z" level=warning msg="[{www.qq.com. 1 1}], from: 127.0.0.1:38838: query failed: context deadline exceeded"
Thu Dec 10 04:20:09 2020 daemon.err mosdns[3586]: time="2020-12-09T20:20:09Z" level=warning msg="[{www.target.com. 28 1}], from: 127.0.0.1:46549: query failed: plugin default reports an err: context deadline exceeded"
Thu Dec 10 04:20:09 2020 daemon.err mosdns[3586]: time="2020-12-09T20:20:09Z" level=warning msg="[{www.target.com. 1 1}], from: 127.0.0.1:25722: query failed: plugin default reports an err: context deadline exceeded"
Thu Dec 10 04:20:09 2020 daemon.err mosdns[3586]: time="2020-12-09T20:20:09Z" level=warning msg="[{www.baidu.com. 1 1}], from: 127.0.0.1:27203: query failed: context deadline exceeded"
Thu Dec 10 04:20:09 2020 daemon.err mosdns[3586]: time="2020-12-09T20:20:09Z" level=warning msg="[{www.target.com. 28 1}], from: 127.0.0.1:46549: query failed: plugin default reports an err: context deadline exceeded"
Thu Dec 10 04:20:09 2020 daemon.err mosdns[3586]: time="2020-12-09T20:20:09Z" level=warning msg="[{www.target.com. 1 1}], from: 127.0.0.1:25722: query failed: plugin default reports an err: context deadline exceeded"
Thu Dec 10 04:20:19 2020 daemon.err mosdns[3586]: time="2020-12-09T20:20:19Z" level=warning msg="[{www.target.com. 28 1}], from: 127.0.0.1:50406: query failed: plugin default reports an err: context deadline exceeded"
Thu Dec 10 04:20:19 2020 daemon.err mosdns[3586]: time="2020-12-09T20:20:19Z" level=warning msg="[{www.baidu.com. 1 1}], from: 127.0.0.1:27203: query failed: context deadline exceeded"
Thu Dec 10 04:20:19 2020 daemon.err mosdns[3586]: time="2020-12-09T20:20:19Z" level=warning msg="[{www.target.com. 28 1}], from: 127.0.0.1:10295: query failed: plugin default reports an err: context deadline exceeded"
Thu Dec 10 04:20:19 2020 daemon.err mosdns[3586]: time="2020-12-09T20:20:19Z" level=warning msg="[{www.target.com. 28 1}], from: 127.0.0.1:42622: query failed: plugin default reports an err: context deadline exceeded"

mosdns 的版本号(mosdns -v):
0.14.0

使用的启动参数或启动方式:
使用作者提供的openwrt启动脚本启动

操作系统和平台:
openwrt_x86_64 19.07.3

进行了什么操作导致了问题的出现:
没有任何特别操作,就是过一段时间就出现了

使用的配置文件:

  level: ""
  file: ""
server:
  bind:
    - udp://127.0.0.1:*
    - tcp://127.0.0.1:*
    - udp://[::1]:*
    - tcp://[::1]:*
  max_udp_size: 1472

plugin:
  entry:
    - default

  plugin:
    ################################# 路由插件
    - tag: default
      type: sequence
      args:
        exec:
          - if:
              - match_ad_domain       
            exec:
              - block                     
            goto: end                   

          - if:
              - match_local_domain              
            exec:
              - forward_local                      
            goto: end

          - if:
              - match_remote_domain       
            exec:
              - forward_remote                 
            goto: end

          - forward_local                          

          - if:
              - match_local_ip                       
            goto: end

          - forward_remote    

        next: end             

    ################################# 匹配插件
    - tag: match_local_domain 
      type: domain_matcher
      args:
        check_cname: false      
        check_question: true    
        domain:
          - "./geosite.dat:cn"

    - tag: match_remote_domain 
      type: domain_matcher
      args:
        check_cname: false
        check_question: true
        domain:
          - "./geosite.dat:geolocation-!cn"

    - tag: match_ad_domain
      type: domain_matcher
      args:
        check_cname: false
        check_question: true
        domain:
          - "./geosite.dat:category-ads-all"

    - tag: match_local_ip  
      type: ip_matcher
      args:
        ip:
          - "./geoip.dat:cn"

    ################################ 功能性插件
    - tag: block 
      type: blackhole
      args:
        rcode: 3 

    - tag: forward_local
      type: forward
      args:
        upstream:
          - addr: https://223.5.5.5/dns-query
            ip_addr: 
               - 223.5.5.5
        deduplicate: false           
        insecure_skip_verify: false  
        timeout: 10                  

    - tag: forward_remote 
      type: forward
      args:
        upstream:
          - addr: https://1.0.0.1/dns-query
            ip_addr: 
               - 1.0.0.1
        deduplicate: false           
        insecure_skip_verify: false  
        timeout: 10                  

后来早上6点整,报错消失了
我的远程dns请求是转发到某远程服务器的,服务器每天早上6点会crontab重启
我发现以上报错有两种,分别是

  • query failed: plugin default reports an err: context deadline exceeded"

  • query failed: context deadline exceeded"

前者是远程服务器请求,后者是本地服务器请求

如何解决Win10网络指示器提示”无法访问互联网“

其实是完全可以上网的。这是因为网络指示器默认不测试本地DNS服务器。

可以通过以下命令解决(需要管理员权限)。

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\POLICIES\MICROSOFT\Windows\NetworkConnectivityStatusIndicator" /v UseGlobalDNS /t REG_DWORD /d 1 /f

然后重启电脑。

[BUG] hosts插件只会解析hosts配置文件的第一行

出现了什么问题
hosts插件只会解析hosts配置文件里的第一行域名配置,第二行和之后的域名配置都不会被解析到,然后导致执行后面的main_sequence等解析流程

使用的配置文件:

plugin:
  - tag: main_server      # 启动服务器
    type: server
    args:
      entry:
        - _default_cache  # 缓存
        - check_in_hosts
        - main_sequence
      max_concurrent_queries: 0
      server:
        - protocol: udp
          addr: 127.0.0.1:53

  - tag: check_in_hosts
    type: hosts
    args:
      hosts: # hosts 文件。可配置多个。至少要配置一个。
        - ./hosts

hosts配置文件:# cat ./hosts

w2.my.iot  192.168.10.52
w1.my.iot  192.168.10.51
w3.my.iot  192.168.10.53

debug log如下: 可以看到w2.my.iot在hosts里被解析到了直接返回,但是w1.my.iot没有在hosts里解析到,执行了后续的main_sequence流程, 实测只有hosts配置文件的第一行会被解析到。

# mosdns -c config.yaml 
2021-02-07T10:19:15.558+0800    info    mosdns/main.go:136      mosdns ver: v1.3.4-0-gc51a109
2021-02-07T10:19:15.558+0800    info    mosdns/main.go:137      arch: amd64, os: linux, go: go1.15.7
2021-02-07T10:19:15.558+0800    info    coremain/run.go:60      loading config  {"file": "config.yaml"}
2021-02-07T10:19:15.559+0800    info    coremain/run.go:111     loading plugin  {"tag": "main_server"}
2021-02-07T10:19:15.559+0800    info    main_server     server/udp.go:56        udp server started      {"addr": "127.0.0.1:53"}
2021-02-07T10:19:15.559+0800    info    main_server     server/tcp.go:52        tcp server started      {"addr": "127.0.0.1:53"}
2021-02-07T10:19:15.559+0800    info    coremain/run.go:111     loading plugin  {"tag": "main_sequence"}
2021-02-07T10:19:15.559+0800    info    coremain/run.go:111     loading plugin  {"tag": "forward_local"}
2021-02-07T10:19:15.560+0800    info    coremain/run.go:111     loading plugin  {"tag": "forward_remote"}
2021-02-07T10:19:15.560+0800    info    coremain/run.go:111     loading plugin  {"tag": "check_in_hosts"}
2021-02-07T10:19:15.560+0800    info    coremain/run.go:111     loading plugin  {"tag": "query_is_local_domain"}
2021-02-07T10:19:15.560+0800    info    coremain/run.go:111     loading plugin  {"tag": "query_is_non_local_domain"}
2021-02-07T10:19:15.570+0800    info    coremain/run.go:111     loading plugin  {"tag": "query_is_ad_domain"}
2021-02-07T10:19:15.570+0800    info    coremain/run.go:111     loading plugin  {"tag": "response_has_local_ip"}
2021-02-07T10:19:15.576+0800    info    coremain/run.go:40      all plugins are successfully loaded
2021-02-07T10:19:20.735+0800    debug   main_server     server/udp.go:86        new query       {"query": "w2.my.iot. 1 1 34229 1", "from": "127.0.0.1:56946"}
2021-02-07T10:19:20.735+0800    debug   main_server     utils/executable_sequence.go:47 exec executable plugin  {"query": "w2.my.iot. 1 1 34229 1", "exec": "_default_cache"}
2021-02-07T10:19:20.735+0800    debug   main_server     utils/executable_sequence.go:47 exec executable plugin  {"query": "w2.my.iot. 1 1 34229 1", "exec": "check_in_hosts"}
2021-02-07T10:19:20.735+0800    debug   main_server     utils/server_handler.go:85      entry returned  {"query": "w2.my.iot. 1 1 34229 1", "status": "responded"}

2021-02-07T10:19:28.951+0800    debug   main_server     server/udp.go:86        new query       {"query": "w1.my.iot. 1 1 37521 2", "from": "127.0.0.1:52735"}
2021-02-07T10:19:28.951+0800    debug   main_server     utils/executable_sequence.go:47 exec executable plugin  {"query": "w1.my.iot. 1 1 37521 2", "exec": "_default_cache"}
2021-02-07T10:19:28.951+0800    debug   main_server     utils/executable_sequence.go:47 exec executable plugin  {"query": "w1.my.iot. 1 1 37521 2", "exec": "check_in_hosts"}
2021-02-07T10:19:28.951+0800    debug   main_server     utils/server_handler.go:85      entry returned  {"query": "w1.my.iot. 1 1 37521 2", "status": "responded"}
2021-02-07T10:19:29.010+0800    debug   main_server     server/udp.go:86        new query       {"query": "253.254.168.192.in-addr.arpa. 12 1 16055 3", "from": "127.0.0.1:54842"}
2021-02-07T10:19:29.010+0800    debug   main_server     utils/executable_sequence.go:47 exec executable plugin  {"query": "253.254.168.192.in-addr.arpa. 12 1 16055 3", "exec": "_default_cache"}
2021-02-07T10:19:29.010+0800    debug   main_server     utils/executable_sequence.go:47 exec executable plugin  {"query": "253.254.168.192.in-addr.arpa. 12 1 16055 3", "exec": "check_in_hosts"}
2021-02-07T10:19:29.010+0800    debug   main_server     utils/executable_sequence.go:47 exec executable plugin  {"query": "253.254.168.192.in-addr.arpa. 12 1  6055 3", "exec": "main_sequence"}
2021-02-07T10:19:29.010+0800    debug   main_sequence   utils/executable_sequence.go:137        exec matcher plugin     {"query": "253.254.168.192.in-addr.arpa. 12 1 16055 3", "exec": "query_is_ad_domain", "result": false}
2021-02-07T10:19:29.010+0800    debug   main_sequence   utils/executable_sequence.go:137        exec matcher plugin     {"query": "253.254.168.192.in-addr.arpa. 12 1 16055 3", "exec": "query_is_local_domain", "result": false}
2021-02-07T10:19:29.010+0800    debug   main_sequence   utils/executable_sequence.go:137        exec matcher plugin     {"query": "253.254.168.192.in-addr.arpa. 12 1 16055 3", "exec": "_query_is_common", "result": false}
2021-02-07T10:19:29.010+0800    debug   main_sequence   utils/executable_sequence.go:47 exec executable plugin  {"query": "253.254.168.192.in-addr.arpa. 12 1 16055 3", "exec": "forward_local"}
2021-02-07T10:19:29.122+0800    debug   forward_local   utils/utils.go:330      untrusted upstream return an err rcode  {"query": "253.254.168.192.in-addr.arpa. 12 1 16055 3", "from": "223.6.6.6:53", "rcode": 3}
2021-02-07T10:19:29.122+0800    debug   forward_local   utils/utils.go:330      untrusted upstream return an err rcode  {"query": "253.254.168.192.in-addr.arpa. 12 1 16055 3", "from": "223.5.5.5:53", "rcode": 3}
2021-02-07T10:19:29.122+0800    warn    main_server     utils/server_handler.go:83      entry returned an err   {"query": "253.254.168.192.in-addr.arpa. 12 1 16055 3", "error": "main_sequence: forward_local: no response"}
2021-02-07T10:19:29.123+0800    debug   main_server     server/udp.go:86        new query       {"query": "253.254.168.192.in-addr.arpa. 12 1 16055 4", "from": "127.0.0.1:52450"}
2021-02-07T10:19:29.124+0800    debug   main_server     utils/executable_sequence.go:47 exec executable plugin  {"query": "253.254.168.192.in-addr.arpa. 12 1 16055 4", "exec": "_default_cache"}
2021-02-07T10:19:29.124+0800    debug   main_server     utils/executable_sequence.go:47 exec executable plugin  {"query": "253.254.168.192.in-addr.arpa. 12 1 16055 4", "exec": "check_in_hosts"}
2021-02-07T10:19:29.125+0800    debug   main_server     utils/executable_sequence.go:47 exec executable plugin  {"query": "253.254.168.192.in-addr.arpa. 12 1 16055 4", "exec": "main_sequence"}
2021-02-07T10:19:29.134+0800    debug   main_sequence   utils/executable_sequence.go:137        exec matcher plugin     {"query": "253.254.168.192.in-addr.arpa. 12 1 16055 4", "exec": "query_is_ad_domain", "result": false}
2021-02-07T10:19:29.135+0800    debug   main_sequence   utils/executable_sequence.go:137        exec matcher plugin     {"query": "253.254.168.192.in-addr.arpa. 12 1 16055 4", "exec": "query_is_local_domain", "result": false}
2021-02-07T10:19:29.135+0800    debug   main_sequence   utils/executable_sequence.go:137        exec matcher plugin     {"query": "253.254.168.192.in-addr.arpa. 12 1 16055 4", "exec": "_query_is_common", "result": false}
2021-02-07T10:19:29.135+0800    debug   main_sequence   utils/executable_sequence.go:47 exec executable plugin  {"query": "253.254.168.192.in-addr.arpa. 12 1 16055 4", "exec": "forward_local"}
2021-02-07T10:19:29.178+0800    debug   forward_local   utils/utils.go:330      untrusted upstream return an err rcode  {"query": "253.254.168.192.in-addr.arpa. 12 1 16055 4", "from": "223.6.6.6:53", "rcode": 3}
2021-02-07T10:19:29.180+0800    debug   forward_local   utils/utils.go:330      untrusted upstream return an err rcode  {"query": "253.254.168.192.in-addr.arpa. 12 1 16055 4", "from": "223.5.5.5:53", "rcode": 3}
2021-02-07T10:19:29.180+0800    warn    main_server     utils/server_handler.go:83      entry returned an err   {"query": "253.254.168.192.in-addr.arpa. 12 1 16055 4", "error": "main_sequence: forward_local: no response"}
^C2021-02-07T10:19:34.328+0800  info    coremain/run.go:45      exiting, bye    {"signal": "interrupt"}

配置文件兼容问题

希望配置文件不兼容的话,希望大版本号能够变更,这样能避免很多麻烦。
0.x.x -->配置不兼容-->1.x.x
版本号大又不是没有先例,比如nvidia,chrome这些版本帝

[BUG]forward 插件中args添加 fastest_ip 属性并设置为true后程序错误,设置为false后程序正常运行。

出现了什么问题
forward插件中args添加fastest_ip : true后程序出错,设置为false后程序正常运行。

描述一下问题的表现。可以直接附上截图或log。建议配置logger插件使用debug级别获取更详细的调试log。
image

2021-02-13T14:23:46.641+0800	debug	main_server	server/udp.go:87	new query	{"query": "www.baidu.com. 1 1 47684 41", "from": "[::1]:64114"}
2021-02-13T14:23:46.641+0800	debug	main_server	executable_seq/executable_cmd_sequence.go:40	exec executable plugin	{"query": "www.baidu.com. 1 1 47684 41", "exec": "_default_cache"}
2021-02-13T14:23:46.641+0800	debug	main_server	executable_seq/executable_cmd_sequence.go:40	exec executable plugin	{"query": "www.baidu.com. 1 1 47684 41", "exec": "main_sequence"}
2021-02-13T14:23:46.641+0800	debug	main_sequence	executable_seq/executable_cmd_sequence.go:130	exec matcher plugin	{"query": "www.baidu.com. 1 1 47684 41", "exec": "query_is_ad_domain", "result": false}
2021-02-13T14:23:46.641+0800	debug	main_sequence	executable_seq/executable_cmd_sequence.go:130	exec matcher plugin	{"query": "www.baidu.com. 1 1 47684 41", "exec": "query_is_local_domain", "result": true}
2021-02-13T14:23:46.641+0800	debug	main_sequence	executable_seq/executable_cmd_sequence.go:40	exec executable plugin	{"query": "www.baidu.com. 1 1 47684 41", "exec": "forward_local"}
2021-02-13T14:23:48.640+0800	debug	main_sequence	executable_seq/executable_cmd_sequence.go:40	exec executable plugin	{"query": "www.baidu.com. 1 1 47684 33", "exec": "_end"}
2021-02-13T14:23:48.640+0800	warn	main_server	server_handler/server_handler.go:95	entry returned an err	{"query": "www.baidu.com. 1 1 47684 33", "error": "main_sequence: context deadline exceeded"}

如何重现

描述一下如何重现该问题。请尽可能的包含:

mosdns 的版本号(mosdns -v):
1.4.0
使用的启动参数或启动方式:
无特殊启动参数
操作系统和平台:
Windows 10 V1909
进行了什么操作导致了问题的出现:
forward 插件中args添加 fastest_ip 属性并设置为true后程序错误,设置为false后程序正常运行。
使用的配置文件:

include: [ ]

log:
  level: debug
  file: ""

plugin:

  ################# 服务插件 ################

  - tag: main_server      # 启动服务器
    type: server
    args:
      entry:
        - _default_cache  # 缓存
        - main_sequence
      max_concurrent_queries: 0
      server:
        - protocol: udp
          addr: 127.0.0.1:53
        - protocol: tcp
          addr: 127.0.0.1:53
        - protocol: udp
          addr: "[::1]:53"
        - protocol: tcp
          addr: "[::1]:53"

  ################# 可执行插件 ################

  - tag: main_sequence
    type: sequence
    args:
      exec:
        - if:
            - query_is_ad_domain    # 已知的广告域名
          exec:
            - _block_with_nxdomain  # 屏蔽
            - _end

        - if:
            - query_is_local_domain   # 已知的本地域名
            - "!_query_is_common"     # 和不常见的请求类型
          exec:
            - forward_local           # 用本地服务器
            - _end

        - if:
            - query_is_non_local_domain  # 已知的非本地域名
          exec:
            - forward_remote             # 用远程服务器
            - _end

          # 剩下的域名用 IP 分流。
          # 有两种方案:"顺序分流"或"并发分流"。
          # 下面的是"顺序分流"的配置。

        - forward_local               # 先请求转发至本地服务器
        - if:
            - response_has_local_ip   # 如果应答包含本地 IP
          goto: _end                  # 就直接采用结果
        - forward_remote              # 否则用远程服务器的结果

          # 如果想用"并发分流"逻辑。将上面的配置注释掉,然后从下面选择一个方式。
          # 注意: 如果上游支持连接复用(tcp,dot,doh),谨慎使用并发分流。
          # 因为服务器响应延时不可预测,不正确配置会导致分流出错。详见下文`补充`。

          # 1. 使用 parallel 实现的"并发分流"逻辑。很像 ChinaDNS 的逻辑。
          #    用于 local 的 ping 延时远小于 remote 的场景。

        # - parallel:
        #     - - forward_local
        #       - if:
        #           - "!response_has_local_ip"  # 如果本地服务器返回的非本地 IP
        #         exec:
        #           - _drop_response            # 应答会被丢弃
        #     - - forward_remote

          # 2. 使用 fallback 实现的"并发分流"逻辑。
          #    用于 local 使用了连接复用的协议,或 ping 延时接近 remote 的场景。

        # - primary:
        #   - forward_local
        #   - if:
        #       - "!response_has_local_ip"
        #     exec:
        #       - _drop_response
        #   secondary:
        #     - forward_remote
        #   stat_length: 0        # 禁用常规的 fallback
        #   threshold: 0
        #   fast_fallback: 200    # 建议配置成 local 最大响应延时(注意:不是 ping 延时)的 2 倍。
        #   always_standby: true

  - tag: forward_local # 转发至本地服务器的插件
    type: forward
    args:
      upstream:
        - addr: https://223.5.5.5/dns-query
        - addr: 101.7.8.9:53

      fastest_ip: true            # 最快 IP 模式。

  - tag: forward_remote # 转发至远程服务器的插件
    type: forward
    args:
      upstream:
        - addr: quic://dns.adguard.com
        - addr: tls://cloudflare-dns.com
          ip_addr:
            - 1.1.1.1
        - addr: tls://dns.google
          ip_addr: # 服务器的 IP 地址。可以配置多个。如果配置了,则不会使用 bootstrap 服务器。
            - 8.8.8.8
        - addr: https://1.0.0.1/dns-query
          ip_addr:
            - 1.1.1.1
        - addr: https://8.8.8.8/dns-query
          ip_addr: # 服务器的 IP 地址。可以配置多个。如果配置了,则不会使用 bootstrap 服务器。
            - 8.8.8.8
      bootstrap:
        - tls://1.1.1.1
        - https://223.5.5.5/dns-query
      fastest_ip: true            # 最快 IP 模式。

  ################ 匹配器插件 #################

  - tag: query_is_local_domain         # 匹配本地域名的插件
    type: query_matcher
    args:
      domain:
        - "ext:./geosite.dat:cn"

  - tag: query_is_non_local_domain    # 匹配非本地域名的插件
    type: query_matcher
    args:
      domain:
        - "ext:./geosite.dat:geolocation-!cn"

  - tag: query_is_ad_domain           # 匹配广告域名的插件
    type: query_matcher
    args:
      domain:
        - "ext:./geosite.dat:category-ads-all"

  - tag: response_has_local_ip        # 匹配本地 IP的插件
    type: response_matcher
    args:
      ip:
        - "ext:./geoip.dat:cn"

[BUG] 复制复杂示例到config-template.yaml后,无法使用。

出现了什么问题

复制复杂示例到config-template.yaml后,无法使用。

2021-02-09T02:07:37.644+0800	info	mosdns/main.go:136	mosdns ver: v1.4.0-0-g7a1bca9
2021-02-09T02:07:37.651+0800	info	mosdns/main.go:137	arch: amd64, os: windows, go: go1.15.7
2021-02-09T02:07:37.651+0800	info	coremain/run.go:60	loading config	{"file": "config.yaml"}
2021-02-09T02:07:37.651+0800	fatal	coremain/run.go:63	failed to parse config from file config.yaml: open config.yaml: The system cannot find the file specified.
2021-02-09T02:07:47.773+0800	info	mosdns/main.go:136	mosdns ver: v1.4.0-0-g7a1bca9
2021-02-09T02:07:47.779+0800	info	mosdns/main.go:137	arch: amd64, os: windows, go: go1.15.7
2021-02-09T02:07:47.779+0800	info	coremain/run.go:60	loading config	{"file": "config.yaml"}
2021-02-09T02:07:47.779+0800	fatal	coremain/run.go:63	failed to parse config from file config.yaml: open config.yaml: The system cannot find the file specified.
2021-02-09T02:08:07.903+0800	info	mosdns/main.go:136	mosdns ver: v1.4.0-0-g7a1bca9
2021-02-09T02:08:07.909+0800	info	mosdns/main.go:137	arch: amd64, os: windows, go: go1.15.7
2021-02-09T02:08:07.909+0800	info	coremain/run.go:60	loading config	{"file": "config.yaml"}
2021-02-09T02:08:07.909+0800	fatal	coremain/run.go:63	failed to parse config from file config.yaml: open config.yaml: The system cannot find the file specified.
2021-02-09T02:08:38.031+0800	info	mosdns/main.go:136	mosdns ver: v1.4.0-0-g7a1bca9
2021-02-09T02:08:38.036+0800	info	mosdns/main.go:137	arch: amd64, os: windows, go: go1.15.7
2021-02-09T02:08:38.036+0800	info	coremain/run.go:60	loading config	{"file": "config.yaml"}
2021-02-09T02:08:38.036+0800	fatal	coremain/run.go:63	failed to parse config from file config.yaml: open config.yaml: The system cannot find the file specified.
2021-02-09T02:09:08.159+0800	info	mosdns/main.go:136	mosdns ver: v1.4.0-0-g7a1bca9
2021-02-09T02:09:08.165+0800	info	mosdns/main.go:137	arch: amd64, os: windows, go: go1.15.7
2021-02-09T02:09:08.165+0800	info	coremain/run.go:60	loading config	{"file": "config.yaml"}
2021-02-09T02:09:08.165+0800	fatal	coremain/run.go:63	failed to parse config from file config.yaml: open config.yaml: The system cannot find the file specified.
2021-02-09T02:09:38.289+0800	info	mosdns/main.go:136	mosdns ver: v1.4.0-0-g7a1bca9
2021-02-09T02:09:38.295+0800	info	mosdns/main.go:137	arch: amd64, os: windows, go: go1.15.7
2021-02-09T02:09:38.295+0800	info	coremain/run.go:60	loading config	{"file": "config.yaml"}
2021-02-09T02:09:38.295+0800	fatal	coremain/run.go:63	failed to parse config from file config.yaml: open config.yaml: The system cannot find the file specified.
2021-02-09T02:10:08.417+0800	info	mosdns/main.go:136	mosdns ver: v1.4.0-0-g7a1bca9
2021-02-09T02:10:08.423+0800	info	mosdns/main.go:137	arch: amd64, os: windows, go: go1.15.7
2021-02-09T02:10:08.423+0800	info	coremain/run.go:60	loading config	{"file": "config.yaml"}
2021-02-09T02:10:08.423+0800	fatal	coremain/run.go:63	failed to parse config from file config.yaml: open config.yaml: The system cannot find the file specified.
2021-02-09T02:10:38.544+0800	info	mosdns/main.go:136	mosdns ver: v1.4.0-0-g7a1bca9
2021-02-09T02:10:38.550+0800	info	mosdns/main.go:137	arch: amd64, os: windows, go: go1.15.7
2021-02-09T02:10:38.550+0800	info	coremain/run.go:60	loading config	{"file": "config.yaml"}
2021-02-09T02:10:38.550+0800	fatal	coremain/run.go:63	failed to parse config from file config.yaml: open config.yaml: The system cannot find the file specified.
2021-02-09T02:11:08.674+0800	info	mosdns/main.go:136	mosdns ver: v1.4.0-0-g7a1bca9
2021-02-09T02:11:08.680+0800	info	mosdns/main.go:137	arch: amd64, os: windows, go: go1.15.7
2021-02-09T02:11:08.680+0800	info	coremain/run.go:60	loading config	{"file": "config.yaml"}
2021-02-09T02:11:08.680+0800	fatal	coremain/run.go:63	failed to parse config from file config.yaml: open config.yaml: The system cannot find the file specified.

2021-02-09 02:07:36,649 DEBUG - Starting WinSW in console mode
2021-02-09 02:07:36,808 INFO - Stopping the service with id 'mosdns'
2021-02-09 02:07:36,810 FATAL - WMI Operation failure: NoSuchService
WMI.WmiException: NoSuchService
在 WinSW.Program.ThrowNoSuchService()
在 WinSW.Program.g__Stop|2_3(<>c__DisplayClass2_0& )
在 WinSW.Program.Run(String[] argsArray, IWinSWConfiguration descriptor)
在 WinSW.Program.Main(String[] args)
2021-02-09 02:07:36,887 DEBUG - Starting WinSW in console mode
2021-02-09 02:07:37,047 INFO - Uninstalling the service with id 'mosdns'
2021-02-09 02:07:37,048 WARN - The service with id 'mosdns' does not exist. Nothing to uninstall
2021-02-09 02:07:37,049 DEBUG - Completed. Exit code is 0
2021-02-09 02:07:37,120 DEBUG - Starting WinSW in console mode
2021-02-09 02:07:37,276 INFO - Installing the service with id 'mosdns'
2021-02-09 02:07:37,286 DEBUG - Completed. Exit code is 0
2021-02-09 02:07:37,360 DEBUG - Starting WinSW in console mode
2021-02-09 02:07:37,517 INFO - Starting the service with id 'mosdns'
2021-02-09 02:07:37,596 DEBUG - Starting WinSW in service mode
2021-02-09 02:07:37,605 DEBUG - Completed. Exit code is 0
2021-02-09 02:07:37,610 INFO - Starting E:\dns\mosdns.exe -c config.yaml
2021-02-09 02:07:37,621 INFO - Started process 7664
2021-02-09 02:07:37,625 DEBUG - Forwarding logs of the process System.Diagnostics.Process (mosdns) to WinSW.DefaultLogAppender
2021-02-09 02:07:47,725 DEBUG - Starting WinSW in service mode
2021-02-09 02:07:47,739 INFO - Starting E:\dns\mosdns.exe -c config.yaml
2021-02-09 02:07:47,751 INFO - Started process 21368
2021-02-09 02:07:47,754 DEBUG - Forwarding logs of the process System.Diagnostics.Process (mosdns) to WinSW.DefaultLogAppender
2021-02-09 02:08:07,854 DEBUG - Starting WinSW in service mode
2021-02-09 02:08:07,868 INFO - Starting E:\dns\mosdns.exe -c config.yaml
2021-02-09 02:08:07,880 INFO - Started process 6292
2021-02-09 02:08:07,883 DEBUG - Forwarding logs of the process System.Diagnostics.Process (mosdns) to WinSW.DefaultLogAppender
2021-02-09 02:08:37,983 DEBUG - Starting WinSW in service mode
2021-02-09 02:08:37,997 INFO - Starting E:\dns\mosdns.exe -c config.yaml
2021-02-09 02:08:38,007 INFO - Started process 5724
2021-02-09 02:08:38,011 DEBUG - Forwarding logs of the process System.Diagnostics.Process (mosdns) to WinSW.DefaultLogAppender
2021-02-09 02:08:39,086 DEBUG - Starting WinSW in service mode
2021-02-09 02:09:08,111 DEBUG - Starting WinSW in service mode
2021-02-09 02:09:08,125 INFO - Starting E:\dns\mosdns.exe -c config.yaml
2021-02-09 02:09:08,136 INFO - Started process 10680
2021-02-09 02:09:08,139 DEBUG - Forwarding logs of the process System.Diagnostics.Process (mosdns) to WinSW.DefaultLogAppender
2021-02-09 02:09:38,241 DEBUG - Starting WinSW in service mode
2021-02-09 02:09:38,255 INFO - Starting E:\dns\mosdns.exe -c config.yaml
2021-02-09 02:09:38,266 INFO - Started process 6344
2021-02-09 02:09:38,269 DEBUG - Forwarding logs of the process System.Diagnostics.Process (mosdns) to WinSW.DefaultLogAppender
2021-02-09 02:10:08,369 DEBUG - Starting WinSW in service mode
2021-02-09 02:10:08,383 INFO - Starting E:\dns\mosdns.exe -c config.yaml
2021-02-09 02:10:08,394 INFO - Started process 17288
2021-02-09 02:10:08,397 DEBUG - Forwarding logs of the process System.Diagnostics.Process (mosdns) to WinSW.DefaultLogAppender
2021-02-09 02:10:38,496 DEBUG - Starting WinSW in service mode
2021-02-09 02:10:38,510 INFO - Starting E:\dns\mosdns.exe -c config.yaml
2021-02-09 02:10:38,521 INFO - Started process 14596
2021-02-09 02:10:38,524 DEBUG - Forwarding logs of the process System.Diagnostics.Process (mosdns) to WinSW.DefaultLogAppender
2021-02-09 02:11:08,625 DEBUG - Starting WinSW in service mode
2021-02-09 02:11:08,639 INFO - Starting E:\dns\mosdns.exe -c config.yaml
2021-02-09 02:11:08,651 INFO - Started process 12052
2021-02-09 02:11:08,654 DEBUG - Forwarding logs of the process System.Diagnostics.Process (mosdns) to WinSW.DefaultLogAppender


如何重现

复制复杂示例到config-template.yaml后,无法使用。

mosdns 的版本号(mosdns -v):1.4.0

使用的启动参数或启动方式:service_control.bat

操作系统和平台:Windows10

进行了什么操作导致了问题的出现:复制wiki内复杂示例内容到config-template.yaml。

使用的配置文件:

完全复制的复杂示例

[BUG] 程序强制退出 有 堆栈信息和配置打包提供

服务突然就退出了

描述一下问题的表现。可以直接附上截图或log。建议配置logger插件使用debug级别获取更详细的调试log。
用 systemctl 看到的日志如下

Jan 25 23:00:42 zmbox systemd[1]: Stopped Mos DNS Server.
Jan 25 23:00:42 zmbox systemd[1]: Started Mos DNS Server.
Jan 25 23:00:42 zmbox mosdns[24108]: 2021-01-25T23:00:42.969+0800        info        mosdns/main.go:136        mosdns ver: v1.2.0-0-ga0c57e1
Jan 25 23:00:42 zmbox mosdns[24108]: 2021-01-25T23:00:42.969+0800        info        mosdns/main.go:137        arch: amd64, os: linux, go: go1.15.7
Jan 25 23:00:42 zmbox mosdns[24108]: 2021-01-25T23:00:42.969+0800        info        mosdns/main.go:157        current working directory: /opt/config/mosdns
Jan 25 23:00:42 zmbox mosdns[24108]: 2021-01-25T23:00:42.969+0800        info        coremain/run.go:61        loading config        {"file": "/opt/config/mosdns/entry.yaml"}
Jan 25 23:00:44 zmbox mosdns[24108]: panic: runtime error: invalid memory address or nil pointer dereference
Jan 25 23:00:44 zmbox mosdns[24108]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x96f173]
Jan 25 23:00:44 zmbox mosdns[24108]: goroutine 13 [running]:
Jan 25 23:00:44 zmbox mosdns[24108]: github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/fast_forward.(*fastUpstream).exchangeTCP(0xc002835920, 0xc00030f710, 0x0, 0x0, 0x0)
Jan 25 23:00:44 zmbox mosdns[24108]:         github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/fast_forward/upstream.go:256 +0x53
Jan 25 23:00:44 zmbox mosdns[24108]: github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/fast_forward.(*fastUpstream).exchangeUDPWithTCPFallback(0xc002835920, 0xc00030f710, 0x2, 0x2, 0xc00507de50)
Jan 25 23:00:44 zmbox mosdns[24108]:         github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/fast_forward/upstream.go:318 +0x87
Jan 25 23:00:44 zmbox mosdns[24108]: github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/fast_forward.(*fastUpstream).Exchange(0xc002835920, 0xc00030f710, 0xc006254000, 0x10, 0x682656790130c7b0)
Jan 25 23:00:44 zmbox mosdns[24108]:         github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/fast_forward/upstream.go:213 +0xd2
Jan 25 23:00:44 zmbox mosdns[24108]: github.com/IrineSistiana/mosdns/dispatcher/utils.ExchangeParallel(0xe306c0, 0xc004f9ec00, 0xc0026f2880, 0xc0001fb550, 0x1, 0x1, 0xc0028357a0, 0xc004f9ec00, 0xc0026f2880, 0x8)
Jan 25 23:00:44 zmbox mosdns[24108]:         github.com/IrineSistiana/mosdns/dispatcher/utils/utils.go:266 +0xf67
Jan 25 23:00:44 zmbox mosdns[24108]: github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/fast_forward.(*fastForward).exchange(0xc005e77cc0, 0xe306c0, 0xc004f9ec00, 0xc0026f2880, 0x203000, 0x93803d, 0xc0002e24b0)
Jan 25 23:00:44 zmbox mosdns[24108]:         github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/fast_forward/fast_forward.go:150 +0x106
Jan 25 23:00:44 zmbox mosdns[24108]: github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/fast_forward.(*fastForward).exec(0xc005e77cc0, 0xe306c0, 0xc004f9ec00, 0xc0026f2880, 0x80, 0x80)
Jan 25 23:00:44 zmbox mosdns[24108]:         github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/fast_forward/fast_forward.go:136 +0x4d
Jan 25 23:00:44 zmbox mosdns[24108]: github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/fast_forward.(*fastForward).Exec(0xc005e77cc0, 0xe306c0, 0xc004f9ec00, 0xc0026f2880, 0x7fcf47765560, 0xc000162280)
Jan 25 23:00:44 zmbox mosdns[24108]:         github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/fast_forward/fast_forward.go:132 +0x49
Jan 25 23:00:44 zmbox mosdns[24108]: github.com/IrineSistiana/mosdns/dispatcher/handler.(*PluginWrapper).ExecES(0xc0028359e0, 0xe306c0, 0xc004f9ec00, 0xc0026f2880, 0x2, 0x2, 0x0)
Jan 25 23:00:44 zmbox mosdns[24108]:         github.com/IrineSistiana/mosdns/dispatcher/handler/plugin_wrapper.go:113 +0xba
Jan 25 23:00:44 zmbox mosdns[24108]: github.com/IrineSistiana/mosdns/dispatcher/utils.executablePluginTag.ExecCmd(0xc004f98280, 0x1b, 0xe306c0, 0xc004f9ec00, 0xc0026f2880, 0xc002835f20, 0x0, 0x0, 0xc005084200, 0x0, ...)
Jan 25 23:00:44 zmbox mosdns[24108]:         github.com/IrineSistiana/mosdns/dispatcher/utils/executable_sequence.go:48 +0x2e5
Jan 25 23:00:44 zmbox mosdns[24108]: github.com/IrineSistiana/mosdns/dispatcher/utils.(*ExecutableCmdSequence).ExecCmd(0xc00009cc20, 0xe306c0, 0xc004f9ec00, 0xc0026f2880, 0xc002835f20, 0xc005084a50, 0xc005084aa0, 0xc005084af0, 0xc005084b40, 0xc005084b90)
Jan 25 23:00:44 zmbox mosdns[24108]:         github.com/IrineSistiana/mosdns/dispatcher/utils/executable_sequence.go:602 +0x9d
Jan 25 23:00:44 zmbox mosdns[24108]: github.com/IrineSistiana/mosdns/dispatcher/utils.WalkExecutableCmd(0xe306c0, 0xc004f9ec00, 0xc0026f2880, 0xc002835f20, 0xe1d9c0, 0xc00009cc20, 0x203001, 0x3b0000c0050859a0)
Jan 25 23:00:44 zmbox mosdns[24108]:         github.com/IrineSistiana/mosdns/dispatcher/utils/executable_sequence.go:621 +0x82
Jan 25 23:00:44 zmbox mosdns[24108]: github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/sequence.(*sequenceRouter).Exec(0xc0002f2190, 0xe306c0, 0xc004f9ec00, 0xc0026f2880, 0xc00019e7e0, 0xc0050959a0)
Jan 25 23:00:44 zmbox mosdns[24108]:         github.com/IrineSistiana/mosdns/dispatcher/plugin/executable/sequence/sequence.go:64 +0x65
Jan 25 23:00:44 zmbox mosdns[24108]: github.com/IrineSistiana/mosdns/dispatcher/handler.(*PluginWrapper).ExecES(0xc004f9e120, 0xe306c0, 0xc004f9ec00, 0xc0026f2880, 0x0, 0x0, 0x0)
Jan 25 23:00:44 zmbox mosdns[24108]:         github.com/IrineSistiana/mosdns/dispatcher/handler/plugin_wrapper.go:113 +0xba
Jan 25 23:00:44 zmbox mosdns[24108]: github.com/IrineSistiana/mosdns/dispatcher/utils.(*DefaultServerHandler).execEntry(0xc0002f2ba0, 0xe306c0, 0xc004f9ec00, 0xc0026f2880, 0x2, 0x2)
Jan 25 23:00:44 zmbox mosdns[24108]:         github.com/IrineSistiana/mosdns/dispatcher/utils/server_handler.go:112+0x90
Jan 25 23:00:44 zmbox mosdns[24108]: github.com/IrineSistiana/mosdns/dispatcher/utils.(*DefaultServerHandler).ServeDNS(0xc0002f2ba0, 0xe306c0, 0xc004f9ec00, 0xc0026f2880, 0xe1d980, 0xc0002e3bf0)
Jan 25 23:00:44 zmbox mosdns[24108]:         github.com/IrineSistiana/mosdns/dispatcher/utils/server_handler.go:82 +0x2f1
Jan 25 23:00:44 zmbox mosdns[24108]: github.com/IrineSistiana/mosdns/dispatcher/plugin/server.(*ServerGroup).startUDP.func1.1(0xe30640, 0xc0000a42c0, 0xc0049d5e00, 0xc0026f2880, 0xc0002e3bf0)
Jan 25 23:00:44 zmbox mosdns[24108]:         github.com/IrineSistiana/mosdns/dispatcher/plugin/server/udp.go:91 +0xb3
Jan 25 23:00:44 zmbox mosdns[24108]: created by github.com/IrineSistiana/mosdns/dispatcher/plugin/server.(*ServerGroup).startUDP.func1
Jan 25 23:00:44 zmbox mosdns[24108]:         github.com/IrineSistiana/mosdns/dispatcher/plugin/server/udp.go:88 +0x4a6

如何重现

描述一下如何重现该问题。请尽可能的包含:

mosdns 的版本号(mosdns -v):
版本号 v1.2.0-0-ga0c57e1
使用的启动参数或启动方式:

操作系统和平台:

进行了什么操作导致了问题的出现:

使用的配置文件:

如果有需要提供 配置 我可以发整个打包给你
因为我这里分了很多配置.想着一次打包都发了

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.