sbwml / luci-app-mosdns

一个 DNS 转发器 - OpenWrt 🎁 MosDNS v5 is Ready! 🎉
https://github.com/IrineSistiana/mosdns
1.23k stars 239 forks source link

mosdns5.3.3 自定义配置无法启动 #261

Open Yumega opened 1 month ago

Yumega commented 1 month ago

使用内置配置可以启动,正常运行 使用自定义配置显示错误

2024-10-03 15:29:45 INFO    unpacking entry {"tag": "cn", "length": 19021, "file": "/var/mosdns/geoip_cn.txt"}
2024-10-03 15:29:45 INFO    unpacking entry {"tag": "cn", "length": 90165, "file": "/var/mosdns/geosite_cn.txt"}
2024-10-03 15:29:45 INFO    unpacking entry {"tag": "geolocation-!cn", "length": 30975, "file": "/var/mosdns/geosite_geolocation-!cn.txt"}
2024-10-03 15:29:45 INFO    loading plugin  {"tag": "geosite_cn", "type": "domain_set"}
2024-10-03 15:29:45 INFO    starting api http server    {"addr": "0.0.0.0:9092"}
2024-10-03 15:29:46 INFO    loading plugin  {"tag": "geoip_cn", "type": "ip_set"}
2024-10-03 15:29:46 INFO    loading plugin  {"tag": "geosite_apple", "type": "domain_set"}
2024-10-03 15:29:46 INFO    starting shutdown sequences
2024-10-03 15:29:46 INFO    all plugins were closed
Yumega commented 1 month ago

没发现自定义配置错误

log:
  level: info
  file: "/var/log/mosdns.log"

api:
  http: "0.0.0.0:9092"

include: []

plugins:
  - tag: geosite_cn
    type: domain_set
    args:
      files:
        - "/var/mosdns/geosite_cn.txt"

  - tag: geoip_cn
    type: ip_set
    args:
      files:
        - "/var/mosdns/geoip_cn.txt"

  - tag: geosite_apple
    type: domain_set
    args:
      files:
        - "/var/mosdns/geosite_apple.txt"

  - tag: geosite_no_cn
    type: domain_set
    args:
      files:
        - "/var/mosdns/geosite_geolocation-!cn.txt"

  - tag: whitelist
    type: domain_set
    args:
      files:
        - "/etc/mosdns/rule/whitelist.txt"

  - tag: blocklist
    type: domain_set
    args:
      files:
        - "/etc/mosdns/rule/blocklist.txt"

  - tag: greylist
    type: domain_set
    args:
      files:
        - "/etc/mosdns/rule/greylist.txt"

  - tag: ddnslist
    type: domain_set
    args:
      files:
        - "/etc/mosdns/rule/ddnslist.txt"

  - tag: hosts
    type: hosts
    args:
      files:
        - "/etc/mosdns/rule/hosts.txt"

  - tag: redirect
    type: redirect
    args:
      files:
        - "/etc/mosdns/rule/redirect.txt"

  - tag: adlist
    type: domain_set
    args:
      files:
        - "/var/disable-ads.txt"

  - tag: local_ptr
    type: domain_set
    args:
      files:
        - "/etc/mosdns/rule/local-ptr.txt"

  - tag: cloudflare_cidr
    type: ip_set
    args:
      files:
        - "/etc/mosdns/rule/cloudflare-cidr.txt"

  - tag: lazy_cache
    type: cache
    args:
      size: 0
      lazy_cache_ttl: 0

  - tag: forward_xinfeng_udp
    type: forward
    args:
      concurrent: 1
      upstreams:
        - addr: "114.114.114.114"

  - tag: forward_local
    type: forward
    args:
      concurrent: 3
      upstreams:
        - addr: "221.179.38.7"    # 广东移动
          enable_pipeline: false
        - addr: "tls://dns.alidns.com"
          bootstrap: 223.6.6.6
          enable_pipeline: false
          insecure_skip_verify: false
          idle_timeout: 30
        - addr: "tls://dot.pub"
          bootstrap: 182.254.116.116    # DNSPod
          enable_pipeline: true
          insecure_skip_verify: false
          idle_timeout: 30

  - tag: forward_remote
    type: forward
    args:
      concurrent: 3
      upstreams:
        - addr: "tls://8.8.8.8"
          dial_addr: "8.8.8.8"
          bootstrap: "8.8.8.8"
          bootstrap_version: 4
          socks5: "127.0.0.1:10801"    # socks5代理, 有其他代理方式或者不需要代理,请删除此行
          idle_timeout: 30
          enable_pipeline: true
          enable_http3: true
          insecure_skip_verify: false
        - addr: "tls://1.1.1.1"
          dial_addr: "1.1.1.1"
          bootstrap: "1.1.1.1"
          bootstrap_version: 4
          socks5: "127.0.0.1:10801"    # socks5代理, 有其他代理方式或者不需要代理,请删除此行
          idle_timeout: 30
          enable_pipeline: true
          enable_http3: true
          insecure_skip_verify: false
        - addr: "tls://208.67.222.222"
          dial_addr: "208.67.222.222"
          bootstrap: "208.67.222.222"
          bootstrap_version: 4
          socks5: "127.0.0.1:10801"    # socks5代理, 有其他代理方式或者不需要代理,请删除此行
          idle_timeout: 30
          enable_pipeline: true
          enable_http3: true
          insecure_skip_verify: false

  - tag: forward_remote_upstream
    type: sequence
    args:
      - exec: prefer_ipv4
      - exec: $forward_remote

  - tag: modify_ttl
    type: sequence
    args:
      - exec: ttl 0-0

  - tag: modify_ddns_ttl
    type: sequence
    args:
      - exec: ttl 5-5

  - tag: has_resp_sequence
    type: sequence
    args:
      - matches: qname $ddnslist
        exec: $modify_ddns_ttl
      - matches: "!qname $ddnslist"
        exec: $modify_ttl
      - matches: has_resp
        exec: accept

  - tag: query_is_non_local_ip
    type: sequence
    args:
      - exec: $forward_local
      - matches: "!resp_ip $geoip_cn"
        exec: drop_resp

  - tag: fallback
    type: fallback
    args:
      primary: forward_remote_upstream
      secondary: forward_remote_upstream
      threshold: 500
      always_standby: true

  - tag: apple_domain_fallback
    type: fallback
    args:
      primary: query_is_non_local_ip
      secondary: forward_xinfeng_udp
      threshold: 100
      always_standby: true

  - tag: query_is_apple_domain
    type: sequence
    args:
      - matches: "!qname $geosite_apple"
        exec: return
      - exec: $apple_domain_fallback

  - tag: query_is_ddns_domain
    type: sequence
    args:
      - matches: qname $ddnslist
        exec: $forward_local

  - tag: query_is_local_domain
    type: sequence
    args:
      - matches: qname $geosite_cn
        exec: $forward_local

  - tag: query_is_no_local_domain
    type: sequence
    args:
      - matches: qname $geosite_no_cn
        exec: $forward_remote_upstream

  - tag: query_is_whitelist_domain
    type: sequence
    args:
      - matches: qname $whitelist
        exec: $forward_local

  - tag: query_is_greylist_domain
    type: sequence
    args:
      - matches: qname $greylist
        exec: $forward_remote_upstream

  - tag: query_is_reject_domain
    type: sequence
    args:
      - matches: qname $blocklist
        exec: reject 3
      - matches: qname $adlist
        exec: reject 3
      - matches:
        - qtype 12
        - qname $local_ptr
        exec: reject 3
      - matches: qtype 65
        exec: reject 3

  - tag: main_sequence
    type: sequence
    args:
      - exec: $hosts
      - exec: jump has_resp_sequence
      - exec: $redirect
      - exec: jump has_resp_sequence
      - exec: $query_is_apple_domain
      - exec: jump has_resp_sequence
      - exec: $query_is_ddns_domain
      - exec: jump has_resp_sequence
      - exec: $query_is_whitelist_domain
      - exec: jump has_resp_sequence
      - exec: $query_is_reject_domain
      - exec: jump has_resp_sequence
      - exec: $query_is_greylist_domain
      - exec: jump has_resp_sequence
      - exec: $query_is_local_domain
      - exec: jump has_resp_sequence
      - exec: $query_is_no_local_domain
      - exec: jump has_resp_sequence
      - exec: $fallback

  - tag: udp_server
    type: udp_server
    args:
      entry: main_sequence
      listen: ":5336"

  - tag: tcp_server
    type: tcp_server
    args:
      entry: main_sequence
      listen: ":5336"
Yumega commented 1 month ago

内置配置点击[已启用]会正常启用,绿色显示MosDNS 运行中 自定义配置点击[已启用],openwrt会显示 hi_21-30 点击保存和应用,点击[已启用],红色显示 MosDNS 未运行

log 错误就是一楼 all plugins were closed

Mrican commented 1 month ago

geosite_apple 是否有导出?

Yumega commented 1 month ago

geosite_apple 是否有导出?

没有进行任何导出操作,因为/var/mosdns/geosite_apple.txt 在使用默认配置以后,里面apple的各种域名内容已经存在

sbwml commented 1 month ago

mosdns 他有一个官方的仓库,官方仓库有个文档连接,可以按照文档来进行自定义配置。

发自我的iPhone

在 2024年10月3日,16:55,Yumega @.***> 写道:

 geosite_apple 是否有导出?

没有进行任何导出操作,因为/var/mosdns/geosite_apple.txt 在使用默认配置以后,里面apple的各种域名内容已经存在

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.