[Feature Request] Add option 'route_only' for resolve action
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 38.2k
- Forks
- 4.6k
- Avg merge
- 19d 15h
- Merged PRs (30d)
- 1
Description
据我在 #3068 描述的问题,在 route 规则进行 resolve action 后,出站中的域名会从 Domain:Port 变成 IP:Port 形式发送给服务器端,经 @reF1nd 查看后得知此为 expected behavior。
此时服务器端入站接收到的请求为 IP:Port,如果我需要在服务器端进一步实现某些依赖 Domain 的分流规则,则需借助 Protocol Sniff,但据文档所述,Listen Fields 中的 sniff 和 sniff_override_destination 选项已被标记为 Deprecated,而新版 sniff action 的用法并不支持 sniff_override_destination 这类选项,导致我目前不得不使用 deprecated options 以及 sniff 这个偏方来实现我的需求。
我在 #3048 看到开发者 @dyhkwong 的解释是这个 Feature 原本是从 V2Ray 继承过来的 bad behavior,所以新版 sniff action 明确删除了这个选项。
我希望开发者们可以酌情考虑下实际使用场景的需求,在 resolve action 中增加 route_only 选项:
"rules":
[
{
"action": "resolve",
"route_only": true
}
]
如果 route_only 被设为 true,则请求还是以 Domain:Port 形式发送给服务器端,这样用户就可以在服务器端根据 Domain 做进一步处理。
目前由于没有这个 Feature,我只能在服务器端使用已被标记为 Deprecated 的 sniff_override_destination 选项,这还会导致 Domain 在服务器端被二次解析,如果不在客户端进行 resolve action,又会导致基于 IP 地址的 ruleset 无法生效。
相关 Issues 还有 #2775,但是他所描述的 DNS 解析问题我认为不存在,因为即使是客户端进行 resolve action 也能在 dns server 里指定 detour 给服务器端出站,但是在 resolve action 中加入这么一个开关确实有一定的必要性。
我已通过 Github Sponsor 捐助以支持开发者维护 sing-box 项目,并有意成为长期 Sponsor,感谢各位开发者的维护。
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the resolve action and the documented sniff and deprecated-option behavior described in the issue. Trace how client-side resolution affects the outbound destination and server-side routing, then define the route_only behavior for both option values; done means the requested Domain:Port preservation works without preventing client-side ruleset matching.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100