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

[Feature] 增强嗅探后 SNI 的 DNS 解析功能以支持基于 IP 的规则匹配 #1802

Closed
3 tasks done
abyss219 opened this issue Jan 21, 2025 · 1 comment
Closed
3 tasks done
Labels
enhancement New feature or request

Comments

@abyss219
Copy link

验证步骤

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

描述

功能需求
在现有的 Clash 实现中,Clash 会在嗅探数据包并提取 SNI 后,将 SNI 用于匹配域名规则。目前的功能仅限于通过 SNI 匹配域名规则,而不会对 SNI 进行进一步的 DNS 解析。

希望新增以下功能:
当 Clash 嗅探到数据包的 SNI 时,除了使用 SNI 匹配域名规则外,还对该 SNI 执行一次 DNS 查询,获取对应的 IP 地址。利用上述 DNS 查询得到的 IP 地址,进一步匹配 Clash 的 IP 规则。

需求背景
我希望通过 DNS 实现广告过滤功能。具体来说,Clash 的上游 DNS 对于广告域名会返回特定的 IP(例如 0.0.0.0),通过此特性来阻止访问广告资源。

在以下情况下可能出现问题:

客户端未使用 Clash 提供的 DNS 解析服务的情况下,数据包被 Clash 嗅探后,虽然能够识别出 SNI,但 Clash 不会对嗅探得到的 SNI 再进行 DNS 解析。这种情况下,匹配域名规则虽然正常,但无法基于 DNS 返回的特定 IP 实现广告拦截功能。

@abyss219 abyss219 added the enhancement New feature or request label Jan 21, 2025
@xishang0128
Copy link
Contributor

直接使用规则集拦截

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

No branches or pull requests

2 participants