Skip to content

app/router/condition.go: Retrieve original target in net.FindProcess() when "IPIfNonMatch" is enabled#5979

Merged
RPRX merged 2 commits intoXTLS:mainfrom
Exclude0122:fix-findprocess-target-ip
Apr 25, 2026
Merged

app/router/condition.go: Retrieve original target in net.FindProcess() when "IPIfNonMatch" is enabled#5979
RPRX merged 2 commits intoXTLS:mainfrom
Exclude0122:fix-findprocess-target-ip

Conversation

@Exclude0122
Copy link
Copy Markdown
Contributor

启用 IpIfNonMatch 时,第二遍尝试匹配规则时会把 routing.Context 包装成 ResolvableContextResolvableContext 会把 sniff 出来的域名解析成 IP,这导致 FindProcess 拿到的 IP 和 TUN 入站拿到的 IP 不一样。

本 PR 会尝试把 ctx 转成 *dns.ResolvableContext 并调用原始 context 的 GetTargetIPs

@RPRX
Copy link
Copy Markdown
Member

RPRX commented Apr 20, 2026

既然 @Fangliding approved 了那等下直接合了

Added comment to clarify usage of original destination IP.
@hippo2025
Copy link
Copy Markdown

It's not very clear to me what happens when Xray core itself initiates a connection, for instance, its DNS module. How will AndroidProcessFinder recognize it? Will it be UID -1 or Xray core UID or something else?

@RPRX RPRX changed the title Retrieve original target in FindProcess when IpIfNonMatch is enabled app/router/condition.go: Retrieve original target in net.FindProcess() when "IPIfNonMatch" is enabled Apr 25, 2026
@RPRX RPRX merged commit d0f533f into XTLS:main Apr 25, 2026
39 checks passed
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

Successfully merging this pull request may close these issues.

4 participants