Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fallback 后不执行后续操作 #633

Closed
4 tasks done
orency opened this issue Mar 4, 2023 · 4 comments
Closed
4 tasks done

fallback 后不执行后续操作 #633

orency opened this issue Mar 4, 2023 · 4 comments

Comments

@orency
Copy link

orency commented Mar 4, 2023

在提交之前,请确认

  • 我已经尝试搜索过 Issue ,但没有找到相关问题。
  • 我正在使用最新的 mosdns 版本(或者最新的 commit),问题依旧存在。
  • 我仔细看过 wiki 后仍然无法自行解决该问题。
  • 我非常确定这是 mosdns 核心的问题。(如果是通过第三方衍生软件使用 mosdns 核心,不确定问题源头时,请先向衍生软件开发者提交问题。)

mosdns 版本

v5.1.2

操作系统

all

Bug 描述和复现步骤

fallback执行完直接返回结束了,导致无法完成后续操作.诸如用black_hole修改应答
可用 use.fontawesome.com 测试
不用fallback比如这样,就可正常修改

    type: sequence
    args:
      - exec: forward 240e:58:c000:1000:116:228:111:118
      - matches: cname domain:cdn.cloudflare.net domain:mktossl.com
        exec: black_hole  2606:4700:20::a:25

使用的配置文件

log:
  level: error
  file: "mosdns.log"

plugins:

  # 国内ip
  - tag: cnip
    type: ip_set
    args:
      files:                        # 从文本文件载入
        - "./geoip_cn.txt"

  - tag: gg
    type: forward
    args:
      upstreams:
          - addr: "tls://8.8.4.4" # 服务器地址
  - tag: query_local
    type: sequence
    args:
      - exec: forward 240e:58:c000:1000:116:228:111:118
      - matches: 
          - qtype 28 
          - resp_ip 2001::/96
        exec: drop_resp
      - matches:
          - qtype 1
          - "!resp_ip $cnip"
        exec: drop_resp


  # fallback 用远程服务器 sequence
  - tag: fallback
    type: fallback
    args:
      primary: query_local
      secondary: gg
      threshold: 70
      always_standby: true    

  - tag: main
    type: sequence
    args:
      - exec: $fallback
      - matches: cname domain:cdn.cloudflare.net domain:mktossl.com
        exec: black_hole  2606:4700:20::a:25
        
  # 启动 udp 和 tcp 服务器。
  - type: udp_server
    args:
      entry: main # 收到的请求会执行上面的逻辑
      listen: 0.0.0.0:6053

mosdns 的 log 记录

No response

@urlesistiana
Copy link
Collaborator

试试 cb59496

@4thanks
Copy link

4thanks commented Mar 10, 2023

那是否可以fallback套娃?例如想远程IP优先的fallback套娃,请问以下写法是否可行?

    #本地IP Sequence
  - tag: local_ip_sequence
    type: sequence
    args:
      - exec: $local_forward
      - exec: jump drop !local_ip
    #远程IP Sequence
  - tag: local_forward_remote_ip_sequence
    type: sequence
    args:
      - exec: $local_forward
      - exec: jump drop local_ip
  - tag: remote_forward_remote_ip_sequence
    type: sequence
    args:
      - exec: $remote_forward
      - exec: jump drop local_ip
    #fallback远程IP
  - tag: fallback_remote_ip
    type: fallback
    args:
      primary: remote_forward_remote_ip_sequence
      secondary: local_forward_remote_ip_sequence
      threshold: 500
      always_standby: false     #回滚时不采用
    #fallback
  - tag: fallback
    type: fallback
    args:
      primary: local_ip_sequence
      secondary: remote_forward
      threshold: 500
      always_standby: true
    #fallback套娃
  - tag: fallback_balance
    type: fallback
    args:
      primary: fallback_remote_ip
      secondary: fallback
      threshold: 500
      always_standby: true

@urlesistiana
Copy link
Collaborator

那是否可以fallback套娃?

fallback是可执行插件,可以套娃。

例如想远程IP优先的fallback套娃,请问以下写法是否可行?

不太懂这个逻辑。你自己试试。

@4thanks
Copy link

4thanks commented Mar 11, 2023

不太懂这个逻辑。你自己试试。

一些偶尔上的网站它们IP不在中国,如果遇到抽风上不了,就想fallback后二次fallback再尝试,以前是fallback不执行后续操作,现在可以了,但又感觉是不是多余了(偶尔多刷新几次又能上)。

  - tag: main
    type: sequence
    args:
      - exec: $fallback
      - matches:
          - qname &./greylist.txt
        exec: $fallback_balance

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

No branches or pull requests

3 participants