Skip to content

Freedom UDP: Fix some cone uses like STUN,... when address is domain#4942

Merged
RPRX merged 1 commit intoXTLS:mainfrom
patterniha:fix-cone
Jul 26, 2025
Merged

Freedom UDP: Fix some cone uses like STUN,... when address is domain#4942
RPRX merged 1 commit intoXTLS:mainfrom
patterniha:fix-cone

Conversation

@patterniha
Copy link
Collaborator

@patterniha patterniha commented Jul 26, 2025

although #4816 has no problem and cover most uses,

but it doesn't help for some special cone uses like STUN, when only initial-request-address can be a domain(and using fakedns)

(#4816 didn't break anything, just didn't fix this situation)

///

this PR also fix situations like STUN when only initial-request-address can be a domain.

///

solving other situations when other requests can also be domain requires more effort, needs the implementation of reverse-IP-lookup-map and some changes to "override.go", but it may be useless, because different domains may have the same-IP, so it is impossible to map IP to domain: #2962 (comment)

@RPRX
Copy link
Member

RPRX commented Jul 26, 2025

Reviewing... 我想了下如果配置中有覆写地址/端口,似乎返回包的来源也没那么重要,可以这么改

@patterniha
Copy link
Collaborator Author

yes, if address is override in config, b.UDP remain nil, so socks-server use (initial)request-address as response-address.

anyway, response-address should be matched with one of request-addresses.

@RPRX
Copy link
Member

RPRX commented Jul 26, 2025

然后这个 PR 的逻辑是如果返回包的来源和发送包时的去向相同,则修改返回包的来源(可能一样,或改成 domain),LGTM

@RPRX RPRX changed the title UDP: fix some cone uses like STUN,... when address is domain Freedom UDP: Fix some cone uses like STUN,... when address is domain Jul 26, 2025
@patterniha
Copy link
Collaborator Author

patterniha commented Jul 26, 2025

if the address before resolving is IP, changedAddr=unchangedAddr
otherwise when resolved-IP is recevied, it convert to domain.

also, for fakedns we have another change(domain <-> fakeIP) and "override.go" handle that, so we should not worry about that.

@RPRX RPRX merged commit 10376f5 into XTLS:main Jul 26, 2025
39 checks passed
@RPRX
Copy link
Member

RPRX commented Jul 26, 2025

@patterniha You've been invited to join Project X organization

@RPRX
Copy link
Member

RPRX commented Jul 26, 2025

虽然暂时没有仓库的维护权限,但是 @patterniha 展现出来的代码能力是值得认可的,感谢你的每一次贡献

@patterniha
Copy link
Collaborator Author

Thank you very much, it's an honor.

Actually, I saw Xray-core on my people's phones and wanted to help develop it so that I could help my people.

@patterniha patterniha deleted the fix-cone branch July 26, 2025 03:39
@KobeArthurScofield
Copy link
Contributor

Thank you, the thing works like I've expected before!

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.

3 participants