Skip to content

routing problem for domains with different IP behaviors #4424

@patterniha

Description

@patterniha

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:

  • in routing rules we save all matched-things(ip/domain) in ctx and then use in outbound, so, even if the address is a domain, we can achieve our goal by using a proper ip-rule and using IPOnDemand/IPIfNonMatch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions