-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
routing problem for domains with different IP behaviors #4424
Comments
This commit is a workaround to address requirements similar to XTLS#4335. Due to the nature of the request, the implementation is rather ugly, with IPv4 preference being hardcoded. The issue in XTLS#4335 is not universal, but my existing functionality happens to be a perfect fit for solving it—only a single line of code needed to be changed. Changes are based on my feature branch `feature-sniff-override-ip`.
I think there are a lot of solutions out there for your needs. |
No, if returned Ips is only in cloudflare range, i forcibly use another proxy instead of worker/domain-fronting. I just want to use worker/domain-fronting as much as possible. Your solution completely disconnects the connection. |
Just specify two DNS, one with Fastly IPs as expectIPs and a normal one. If the DNS query result contains both Fastly and Cloudflare IPs, only Fastly ones are retained, and you can route the connections with an IP-based rule. Otherwise, the normal DNS is used as fallback and all IPs are returned. |
So, we have a redundant dns-query for all cloudflare domains! |
You can configure to use this DNS to resolve only certain domains. And the results are cached, so there will not be too many duplicate queries. "8.8.8.8",
{
"address": "8.8.8.8",
"domains": ["domain:twimg.com"],
"expectIPs": ["geoip:fastly"],
"skipFallback": true
} |
Certain domains??? Any domain can behave like this. |
Well, in this case, most domains require 2 queries. |
Yes, this feature should be added. (I don't want any of this for myself, I want it for all Iranian users.) |
I think I understand what you are talking about. I don't care about ctx, I just care about solving the problem in the easiest way possible. Xray-core/app/dns/nameserver.go Line 206 in 2cba2c4
to Xray-core/app/dns/nameserver.go Line 194 in 2cba2c4
|
I've submitted a similar issue #4146 before, but it doesn't seem to be a priority for developers. And it's hard to consider the current implementation "a bug" since Xray/v2ray has worked this way since a few years ago. No user has reported any practical issue related to this since then. |
geoip:fastly is just an example, other ips could be of any range, so we need "notExpectIPs". @HeXis-YS solution with some changes completely solve this problem. Suppose this solution:
the problem is that the second dns-query-result may not be the same as the first one.(suppose the first one only contains cloudflare-ips and the second one contains both cloudflare and non-cloudflare ips) so we also need to add "ignoreExpectIPsWhenNoMatch" bool option for each DnsServerObject, and change the: Xray-core/app/dns/nameserver.go Lines 205 to 207 in 2cba2c4
to:
/// so with:
and using "dialerProxy" + "forceIP" in outbound, the problem is completely solved, and we can achieve our goal. Thank you very much @HeXis-YS. |
是否是 expected IP 是另一个问题,这个确实可以加个选项 |
I just realized that Xray-core already had "notExpectIPs". my so only "ignoreExpectIPsWhenNoMatch" option should be implemented. |
the #4335 issue has become very messy and confusing and many people have misunderstood the problem.
although it was my fault that I couldn't express the problem correctly.
Problem:
assume that built-in-dns return [ip1, ip2] in answer of dns-query for the domain "example.com".
and we want to use ip2 in outbound.
but with the current capabilities of Xray-core this is not possible, even with using features like: loopback, dialerProxy, IPOnDemand, sniffing,...
Application1:
assume that twimg.com return [ip1, ip2]
and ip1 is behind cloudflare and ip2 is behind fastly.
and we have two outbounds: the first is cloudflare-worker(that doesn't support cloudflare ips) and the second is freedom-fragment.
and we want to use worker as much as possible.
so we should choose ip2 and worker-outbound.
Application2:
we have two outbounds: the first is tls-repack-domain-fronting and the second is freedom-fragment: example
cloudflare-ips doesn't support domain-fronting.
but we want to use domain-fronting as much as possible.
so we should choose ip2 and tls-repack outbound.
Suggested solution:
The text was updated successfully, but these errors were encountered: