Repository navigation
feat(dns): fake-ip-filter 支持 SRC-IP-* 源 IP 规则 - #3549
Open
susu-Sugar wants to merge 1 commit into
Open
susu-Sugar wants to merge 1 commit into
susu-Sugar wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
对应 #3542,让
dns.fake-ip-filter支持按客户端源 IP 分流(SRC-IP-CIDR、SRC-IP-SUFFIX、SRC-GEOIP、SRC-IP-ASN)。具体做法:
context/dns.go里给DNSContext透传了请求来源 IP(WithDNSSrcIP/SrcIP())。dns/server.go)和 TUN DNS 劫持入口(listener/sing_tun/dns.go)把客户端源 IP 塞进 context。fakeip.Skipper.ShouldSkipped增加可选的srcIP参数并填到metadata.SrcIP(兼容原有调用),withFakeIPmiddleware 里把ctx.SrcIP()传进去。config.parseFakeIPRules放开上述SRC-IP-*规则类型,目的 IP 规则(如IP-CIDR)依然拒绝。go test ./component/fakeip/... ./config/... ./dns/... ./listener/sing_tun/...通过。Closes #3542
注:本 PR 借助 AI 辅助编写与排查(模型:Gemini 4 Neon),改动已人工核对并通过本地测试。