Skip to content

[Feature] dns.fake-ip-filter 支持黑白名单共存 #2134

@DustinWin

Description

@DustinWin

验证步骤

  • 我已经阅读了 文档,确认了该功能没有实现
  • 我已在 Issue Tracker 中寻找过我要提出的功能请求,并且没有找到
  • 我是中文用户,而非其他语言用户

描述

场景: 当配置 fake-ip-filter-mode: whitelist 时,设置仅规则集 proxy 走 fake-ip,其它域名都走 realip,配置如下:

dns:
  enable: true
  ipv6: true
  listen: 0.0.0.0:1053
  fake-ip-range: 28.0.0.1/8
  enhanced-mode: fake-ip
  fake-ip-filter: ['rule-set:proxy']
  fake-ip-filter-mode: whitelist
  nameserver:
    - quic://dns.alidns.com:853
    - https://doh.pub/dns-query

规则集 proxy 内会存在需要走 realip 的域名,此时就需要额外步骤去规则集 proxy 内剔除该域名,很不灵活

需求: fake-ip-filter-mode 配置项删除,并fake-ip-filter 拆分成 fake-ip-filterfake-ip-exclude-filter
解释:

  1. fake-ip-filter 解释:fakeip 过滤,配置的地址不会下发 fakeip 映射用于连接,即走 realip(与目前的功能保持一致)
  2. fake-ip-exclude-filter 解释:配置的地址会下发 fakeip 映射用于连接,即走 fake-ip
  3. 关于优先级,
  • ① 当配置 fake-ip-filter-mode: blacklist 时,fake-ip-filter 优先级大于 fake-ip-exclude-filter,即两个配置项里存在重复域名时,仅存在于 fake-ip-filter 里的域名生效
dns:
  enable: true
  ipv6: true
  listen: 0.0.0.0:1053
  fake-ip-range: 28.0.0.1/8
  enhanced-mode: fake-ip
  fake-ip-filter: ['rule-set:proxy']
  fake-ip-exclude-filter: ['rule-set:proxy,cn']
  fake-ip-filter-mode: blacklist
  nameserver:
    - quic://dns.alidns.com:853
    - https://doh.pub/dns-query

上述配置中,proxy 规则集走 realip,cn 规则集走 fake-ip

  • ② 当配置 fake-ip-filter-mode: whitelist 时,fake-ip-exclude-filter 优先级大于 fake-ip-filter,即两个配置项里存在重复域名时,仅存在于 fake-ip-exclude-filter 里的域名生效
dns:
  enable: true
  ipv6: true
  listen: 0.0.0.0:1053
  fake-ip-range: 28.0.0.1/8
  enhanced-mode: fake-ip
  fake-ip-filter: ['rule-set:proxy']
  fake-ip-exclude-filter: ['rule-set:proxy,cn']
  fake-ip-filter-mode: whitelist
  nameserver:
    - quic://dns.alidns.com:853
    - https://doh.pub/dns-query

上述配置中,proxy 规则集走 fake-ip,cn 规则集也走 fake-ip

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions