Skip to content

Xray config compatibility on current main (#319) - #353

Merged
aimalygin merged 23 commits into
mainfrom
claude/config-compat-319
Nov 24, 2026
Merged

aimalygin merged 23 commits into
mainfrom
claude/config-compat-319

Conversation

@aimalygin

Copy link
Copy Markdown
Owner

The merge commit of the unchanged head of #319, so that the pull request closes as merged, and three commits on top that settle what its review left open.

Stacked on #351. One of the commits on top changes code that #280 adds, so this branch starts from #351's head (79f47cf) and shows its four commits too until that pull request is merged. Merge #351 first.

Commit What
#319 bb1a0a5, merged as 1f33d09 Full Xray JSON profiles start: inert fields are accepted with warnings, localhost and fakedns DNS servers, sockopt.domainStrategy on proxy outbounds, RAW's http header, up to 32 dns.servers
on top 7dc187b The TLS version, suite and curve fields fail under fingerprint: "unsafe" instead of being ignored
on top defe5c5 A phone's SRV or TXT lookup asks at most eight servers
on top 36ee8e5 The Android and Apple integrations refuse a profile whose only DNS servers are localhost

The author has not answered since 2026-11-17; the review's requests are carried out here.

The merge

#319's first commit is a copy of #308's first commit. #308 is in main with its follow-up and one more commit, so wherever the two meet, main's side is taken.

On top

config: refuse the TLS version, suite and curve fields under fingerprint unsafe (7dc187b)

#319 accepts minVersion, maxVersion, cipherSuites and curvePreferences with a warning and ignores them. Under a uTLS fingerprint, the default, that is what Xray-core does: its copyConfig drops them. On QUIC they have nothing to decide.

With fingerprint: "unsafe" Xray-core hands the handshake to Go's crypto/tls, which applies all four, and the rustls handshake here would not. Ignored, a minVersion of 1.3 would accept a TLS 1.2 server, and curvePreferences could not hold the key exchange to a group. A nonempty one fails there now. Nothing regresses: on main the parser does not know these fields, and every such configuration fails.

dns: a phone's SRV or TXT lookup asks at most eight servers (defe5c5)

#280 asks dns.servers in turn, four seconds each, before every dial of an outbound with an addressPortStrategy. #319 raises dns.servers from 8 to 32. Together a dial through 32 servers that do not answer would wait more than two minutes. The lookup takes the first eight servers it can ask; localhost and DNS-over-TLS servers are passed over and not counted.

mobile: refuse a profile whose only DNS servers are localhost (36ee8e5)

#319's last commit lets both integrations start a profile that lists localhost. Both create the core with the StaticOnly bootstrap mode, since the platform resolver would ask the tunnel itself, so inside the VPN localhost answers the names dns.hosts maps and no other. A profile whose only servers are localhost started, and the tunnel resolved nothing.

localhost is now no upstream in either preflight, as fakedns already is none:

  • alone, without fake-IP, the profile is refused. Apple reports the existing XrayMobileDNSPreflightError.unavailable, whose text now names localhost, so no public case is added; Android's preparation throws with a message that says what to add;
  • beside fakedns the fake-IP routing check applies, where it was skipped because localhost counted as a server;
  • beside a server on the wire, and under explicit system DNS servers on Apple, nothing changes.

The provider's own resolvedDNSConfiguration is untouched: the preflight runs before it.

Review notes

Conflict with #352. This branch and #352 both add entries at the same places of crates/xray-config/src/surface.rs and tests/fixtures/config-tooling/cases.json. Whichever is merged second needs both kept there.

Verification

  • On this branch locally, all with --locked: cargo fmt --all -- --check; clippy for the whole workspace with the CI flags; cargo doc --workspace --no-deps with -D warnings; cargo check -p xray-ffi for aarch64-apple-ios and aarch64-linux-android; scripts/tests/check-public-fixtures.test.sh; and the whole suite, cargo test --workspace --exclude xray-rust-fuzz --all-targets --no-fail-fast: 4126 passed, 0 failed, 209 ignored. All pass. The first rustdoc run failed on a link from a public doc comment to a private constant in the lookup commit; the comment was reworded, and rustdoc, the format check and clippy for xray-transport were run again on the final head (36ee8e5). The test suite was not run again after that one-comment change.
  • The Apple preflight tests, 16 with the new one, pass in a scratch package that holds only Sources/XrayAppleShared and its tests: the real package cannot load without the XCFramework, which is not built on this machine. Nothing under Sources/XrayAppleTunnel changes on top of Xray config compatibility: warn on inert fields, localhost DNS, proxy sockopt.domainStrategy, Xray-style FakeDNS, TCP http header, up to 32 DNS servers #319.
  • The Android unit tests, :xraymobile:testDebugUnitTest with strict dependency verification: 245 run, 34 skipped, 0 failed.
  • CI has not run Xray config compatibility: warn on inert fields, localhost DNS, proxy sockopt.domainStrategy, Xray-style FakeDNS, TCP http header, up to 32 DNS servers #319's code on a base newer than 0.10.1; this pull request's CI is the first.
  • Not run locally, left to CI: the live interop with Xray-core, the fuzz corpus replay, the remaining script gates and the mobile builds.
  • Not validated on a device: localhost and fakedns profiles through the shipped integrations, RAW's http header against a real Xray-core server, and domainStrategy on a dual-stack network.

🤖 Generated with Claude Code

Loretiks and others added 23 commits November 17, 2026 19:33
Outbound health only changed through the observatory's periodic probes,
and its interval sleep could not be woken. With leastPing and a long
probeInterval, a server that died stayed selected until the next round:
up to ten minutes with probeInterval 10m, every new flow failing.

Flows now report failed opens. SOCKS/HTTP CONNECT, HTTP forwarding and
TUN TCP (DNS TCP proxy included), and TUN UDP report the leaf they were
routed to when its open times out or fails with a refused, reset or
timed-out connection or a TLS, REALITY or transport handshake error.
Remote closes, target refusals, DNS errors and a down local network are
not reported. A report is a per-leaf atomic flag in the selection
overlay plus one Notify wake-up, and only on the error path.

The observatory watches its observed leaves and each observed balancer's
fallback (fallbackTag or the default outbound). Its interval wait is now
woken by reports: a reported leaf is probed again once 10 s have passed
since its last probe, and when no observed member of a balancer is
healthy, a failure through a member or the fallback has all members
probed again, at most once per 15 s. Probe results go through the
existing record path, so a failed re-probe moves leastPing to the next
healthy member and a success keeps or restores the leaf. The scheduled
round is unchanged and re-probes reuse its concurrency bound; without
reports behaviour is as before. State is bounded by the leaf and
balancer counts; no task or queue grows with the number of failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013187aoMHvrWEfXT9ArqxdU
(cherry picked from commit 144b045)
Full Xray JSON subscriptions carry fields Xray-core accepts and that change
nothing for this client, and every one of them failed parsing: root stats,
api, metrics, version and geodata (v26's scheduled geodata downloader),
routing.domainMatcher, sockopt.tcpNoDelay, mKCP congestion/readBufferSize/
writeBufferSize, and TLS minVersion, maxVersion, cipherSuites,
curvePreferences, useSystemCA, show and echConfigList.

Each is now type-checked as Go decodes it and accepted with a warning that
names what is ignored. A uTLS fingerprint decides the four TLS knobs, as
Xray-core's copyConfig drops them. echConfigList connects without ECH and
its warning says the server name goes out in the clear.
disableSystemRoot: true is accepted only beside pinnedPeerCertSha256, where
pins decide trust in both cores; without a pin it still fails, since
ignoring it would trust the system roots the config turned off. Unknown keys
and certificates/masterKeyLog/echServerKeys/echSockopt stay errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013187aoMHvrWEfXT9ArqxdU
(cherry picked from commit 76025ee)
Xray-core's "localhost" DNS server asks the system resolver; xray-rust
refused it, so subscriptions that list it failed to start.

A localhost entry (string or object address, any case) now compiles to a
System transport that sends nothing on the wire: the query is answered from
the core's bootstrap resolver (dns.hosts, then the platform resolver under
the System bootstrap mode), bypassing routing. Its domains gain Xray-core's
local rules (dotless names, .local, .lan, .home.arpa, ...), answers carry
the platform's TTL or Xray-core's 300 s default and enter the destination
cache like other servers'. A failed or empty lookup moves on to the next
server; under StaticOnly only dns.hosts answers, so the tunnel never asks
itself. The TUN DNS proxy asks a localhost upstream locally over UDP and
TCP through the same exchange.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013187aoMHvrWEfXT9ArqxdU
(cherry picked from commit eaa38e7)
sockopt.domainStrategy was refused on every proxy outbound, so profiles that
pin the server's family (UseIPv4 on VLESS and the like) failed to start.

Xray-core's DialSystem resolves a domain server with the strategy before
dialing. VLESS, VMess, Trojan, Shadowsocks, SOCKS, HTTP and Hysteria now do
the same: the stream carrier (and an XHTTP download leg, with its own
sockopt or the outbound's under penetrate) wraps the bootstrap resolver in
the freedom DomainStrategyResolver, after addressPortStrategy, so the
families, their order and the Use/Force fallback match freedom's. A
strategy beside dialerProxy or proxySettings stays refused on these
outbounds, since the chain would carry the server's name rather than the
resolved address; outbounds that dial no server keep accepting only AsIs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013187aoMHvrWEfXT9ArqxdU
(cherry picked from commit 65d14d0)
Configs that use Xray-core's FakeDNS (a "fakedns" DNS server, usually with
root fakeDns pools and the fakedns sniffer) were refused.

A fakedns entry in dns.servers (string or object address, any case) now
turns on the existing dns.fakeIp with the first IPv4 pool of root fakeDns
(an object or an array, also spelled fakedns as Go's decoding accepts) and
its poolSize, or Xray-core's automatic 198.18.0.0/15 (65535 addresses under
UseIPv4, 32768 otherwise). The entry is dropped from the wire servers, as
Xray-core's internal lookups skip it. IPv6 pools are ignored with a warning
since fake addresses are IPv4 only, and with no IPv4 pool (or UseIPv6
without fakeDns) FakeDNS stays off with a warning. Every name is faked;
where Xray-core's server plan could leave names to other servers, a warning
says so. An explicit dns.fakeIp wins; unused fakeDns pools warn; malformed
pools fail as Go fails them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013187aoMHvrWEfXT9ArqxdU
(cherry picked from commit a78f1c4)
tcpSettings/rawSettings header.type "http" (Xray-core's
transport/internet/headers/http) was refused, so HTTP-camouflaged RAW
profiles failed to start.

The raw transport now gets a RawHttpHeader layer above TLS/REALITY, where
Xray-core's TCP dialer puts its authenticator: the first write goes out after
a request head built as AuthenticatorRequest builds it (method, a path drawn
per connection, headers sorted by name with a value drawn per connection,
StringList splitting included, or Xray-core's Chrome defaults with the
process's anchored User-Agent and Sec-CH-UA), and the first read drops the
server's response head through its blank line, at most 8192 bytes. rawSettings
wins over tcpSettings, the response object is checked and unused, and Vision
is refused on the header as Xray-core refuses it. Request text with CR/LF,
an empty header name or a null value fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013187aoMHvrWEfXT9ArqxdU
(cherry picked from commit 9054f85)
More than eight DNS servers failed to parse, an arbitrary cap Xray-core does
not have; full subscriptions list more. The managed resolver already plans
any number of servers (its selection tracker grows past machine words), so
the parser bound rises to 32, still keeping a config's server list small.
The TUN DNS proxy keeps forwarding to the first eight distinct upstreams,
which share its five-second budget and its 16-bit attempt mask.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013187aoMHvrWEfXT9ArqxdU
(cherry picked from commit 63eb024)
A nonempty tlsSettings.echConfigList was accepted with a warning and the
handshake went out without ECH, sending serverName in the clear. Xray-core
does the opposite on purpose: when it has no usable ECH config it installs
an invalid one so the connection fails (transport/internet/tls/ech.go). For
a profile that hides a blocked name behind ECH, accepting it was fail-open.

A nonempty echConfigList is now a parse error again until ECH is
implemented; an empty string or null asks for no ECH and stays accepted.
The test and the config-tooling case flip with it, and a separate case
keeps a TLS warning (minVersion) covered. Docs and the contract say so,
and the CHANGELOG entry no longer claims it is accepted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013187aoMHvrWEfXT9ArqxdU
dns.fakeIp fakes every A query and has no domain filter, but a fakedns
entry was mapped onto it wherever it stood, with only a warning. In
Xray-core, ["8.8.8.8", "fakedns"] reaches fakedns only when 8.8.8.8 fails,
and a fakedns with domains fakes those names first (sortClients in
app/dns/dns.go). Faking everything changes what routing sees: geoip rules
stop matching names that arrived as real addresses, LAN names get fake
addresses, and applications that need a real address break.

Only the case Xray-core sends every name to fakedns first now maps: the
first entry, without domains, while no other server lists domains. A
localhost server counts as one with domains, since Xray-core gives it its
local rules and asks it first for dotless and .lan/.local names. Every
other placement fails parsing, as it did before this PR, with or without
an explicit dns.fakeIp. Tests, a config-tooling case and the docs follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013187aoMHvrWEfXT9ArqxdU
exchange_system_dns_query answered any question other than A or AAAA with
NOERROR and no records. The TUN DNS proxy walks its upstreams in config
order and takes a NOERROR answer as final, so with
"servers": ["localhost", "1.1.1.1"] an SRV, TXT, MX, PTR or HTTPS query got
"no records" and 1.1.1.1 was never asked.

Such a question, one outside class IN, or one for the root name, is now an
error (ErrorKind::Unsupported) before any lookup, so the proxy moves on to
its next upstream. A and AAAA are unchanged. The transport test covers the
question kinds, and a runtime test sends an SRV query through a TUN whose
DNS servers are localhost and a UDP upstream and expects the upstream's
answer; it fails without the fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013187aoMHvrWEfXT9ArqxdU
raw_http_header is applied only by the carrier (outbound/carrier.rs), and
freedom and DNS outbounds dial their sockets without one:
stream_transport_is_dialable lets Raw through, so header.type "http" on
them parsed and was then ignored. Before this PR it was a parse error, and
Xray-core frames every TCP dial of these outbounds with the authenticator,
so their bytes would go out bare where Xray-core sends the head.

The parser now refuses the header on freedom (and its alias direct) and
DNS outbounds, at the header.type of the settings Xray-core reads
(rawSettings unless null, else tcpSettings). A header of type none stays
accepted. Covered by a parser test and a config-tooling case; docs and
the contract note it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013187aoMHvrWEfXT9ArqxdU
The test wrote every piece of the response head into a tokio duplex before
the client read, so one read could return the whole head and the search for
its end across reads never ran.

The reads now come from a test carrier that returns each scripted piece
from a read of its own (no new dev-dependency; tokio-test's io::Builder
would do the same). The head is cut at every byte offset, sent one byte per
read, and with its blank line split over reads, and the test checks the
number of carrier reads, so each piece is known to arrive alone. Searching
only the newest bytes for the end of the head, instead of the last three
bytes before them too, now fails the test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013187aoMHvrWEfXT9ArqxdU
With enableParallelQuery every selected server was asked at once, and
under UseIP each runs A and AAAA as separate exchanges: 64 exchanges for
one lookup over 32 servers. The managed DNS limit is its places plus four
waiters per place (DnsRuntimeLimits::for_profile): 8 + 32 on LowMemory,
16 + 64 on Mobile, so one lookup already had exchanges refused with
"managed DNS operation limit reached" on LowMemory, and the second
concurrent one on Mobile.

A parallel lookup now keeps at most eight server lookups in flight
(MAX_PARALLEL_DNS_SERVER_LOOKUPS), starting the next in plan order as each
settles. Eight is the server bound before this PR, so a lookup asks at most
as many exchanges at once as it could before (16 under UseIP), and the TUN
DNS proxy already stops at eight upstreams. Because lookups start in plan
order, the ones in flight are always the earliest unsettled, so group
settling in plan order and the first-answer race are unchanged. A resolver
test over twelve servers checks that all are asked, never more than eight
at once, alone and as one group. Docs and xray-core-differences note the
difference from Xray-core, which starts them all.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013187aoMHvrWEfXT9ArqxdU
…ervers

Nothing under platform/ changed with the core. Android's DNS bootstrap threw
"special DNS server `localhost` is not supported yet" for the object form,
and Apple's returned nil, which the provider turns into
outboundServerResolutionFailed; the same checks covered fakedns. The string
forms were looked up as host names, so "fakedns" failed there too. A
subscription listing either still could not start through the shipped VPN
integrations.

Both bootstraps now treat localhost and fakedns (string or object address,
any case) as servers with no endpoint: the core answers localhost from its
own bootstrap resolver and maps fakedns onto fake-IP, so neither is resolved
or pinned into dns.hosts. The object form's other fields are still checked.
In the fake-IP routing preflight (Android's prepare step, Apple's
XrayMobileDNSPreflight) a fakedns entry counts as fake-IP and not as an
upstream, so ["fakedns"] alone with a Freedom default is refused as an
enabled dns.fakeIp without servers is, and it cannot be combined with
explicit system DNS servers on Apple. Android's dns.servers bound rises
from 8 to 32 to match the core.

Swift tests for both pieces ran on macOS against a debug macOS-only
XCFramework. The Kotlin tests are updated and added but were not run: there
is no Android SDK in this environment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013187aoMHvrWEfXT9ArqxdU
…s.servers

На Android, iOS и tvOS нет /etc/resolv.conf, поэтому SRV/TXT для
addressPortStrategy не к кому было отправлять: каждый дайл ходил на
127.0.0.1:53 и [::1]:53. Теперь на телефоне записи спрашиваются у
dns.servers ядра, в порядке конфига, 4 с на сервер, TC по UDP повторяется
по TCP. С resolv.conf (десктоп) всё как в Go. Без query transport или
серверов lookup пропускается с одним warning, дайл идёт на сервер из
конфига.

Запрос об адресе сервера outbound не маршрутизируется: маршрут мог увести
его в тот же outbound с addressPortStrategy, который сейчас открывается.
UDP-серверы спрашиваются напрямую через защищённый сокет ядра (как Go
спрашивает nameserver из resolv.conf), TCP, DoH и DoQ через локальный путь
транспорта, как сервер с +local. DoT, доступный только через
маршрутизацию, не спрашивается.

- ConfiguredRecordResolver: сырые SRV/TXT-запросы через DnsQueryTransport,
  проверки и сортировка общие с SystemRecordResolver
- ядро ставит слот в дайлер (with_unconfigured_record_resolver) и
  заполняет его на каждом старте; CompiledNameServerPolicies::record_servers
- tracing стал обычной зависимостью xray-transport: вызов на пути телефона
  не собирался вне macOS (E0433)
- тесты: ответ SRV (с повтором по TCP) и TXT из локального DNS-сервера,
  мёртвый сервер пропускается, NXDOMAIN, запрос идёт мимо маршрутизации
- docs/xray-core-differences.md и CHANGELOG: осознанное отличие от Go
…#344)

A selected geosite entry was limited to 200,000 domains, while a
configuration may hold 250,000 domain matchers. Loyalsoldier's
category-ads-all, a common ad-blocking rule, passed 200,000 (reported at
203,233), and a configuration that named it failed to load.

The entry limit is now the configuration's budget, MAX_CONFIG_DOMAIN_MATCHERS.
That budget is unchanged and is charged on every reference, so no
configuration holds more than it could before; an entry that large leaves
little room for other domain rules beside it.

An error about an entry over a limit read as if the file were corrupt. It
now names the entry: "invalid geodata file <path>: entry CODE: ...". This
covers geoip entries too.
feat(transport): SRV/TXT для addressPortStrategy на телефоне через dns.servers

CHANGELOG.md: git placed the entry inside an earlier release's section;
it goes to the Unreleased list.
…s at 250,000

With the entry limit at 250,000, Loyalsoldier's category-ads-all (reported
at 203,233 domains) loads alone and still does not load beside geosite:cn
(110,258): the two are 313,491 domain matchers, and a configuration could
hold 250,000. An ad list and a country list in one configuration is the
common case, so the first change fixed little by itself.

Measured on macOS, release build, synthetic suffix names of 22 bytes:

  entries              kept      peak of the load
  203,233              5.3 MB    15.8 MB
  203,233 + 110,258    8.1 MB    18.5 MB
  500,000 in one       12.9 MB   36.5 MB
  1,000,000 in one     25.9 MB   71.4 MB

About 26 bytes a domain kept and about 70 while an entry is compiled. So
the two limits do different work and are set apart again:

- A configuration may hold 500,000 domain matchers: some 13 MB kept at
  most, where 250,000 kept 6.5 MB. The total of 1,000,000 domain and IP
  matchers is unchanged.
- An entry may hold 250,000 domains, not the configuration's budget: that
  bounds the peak of a load at some 17 MB above what is kept. An entry of
  500,000 would peak at 36 MB, more than an iOS tunnel extension can spare
  from its 50 MB.

Not measured: the real Loyalsoldier file, whose entries hold regular
expressions too, and an iOS extension.
…o the server

#280 tests the phone's SRV and TXT lookups at the transport: a resolver
over dns.servers and a stand-in for the core's query transport. Nothing
ran the path as a core runs it, and it only exists where there is no
/etc/resolv.conf, so no desktop or CI run reached it.

The new test starts a core whose SOCKS outbound names a server nothing
resolves, with TxtPortAndAddress, and whose dns.servers is a UDP server
that answers the TXT record with the address of a real proxy server. The
configuration routes the DNS module's queries into that same outbound,
which is where a routed lookup would wait for the outbound it is part of
opening. A flow through the SOCKS inbound has to come back from the
proxy server, the proxy server has to see one connection and the DNS
server one question.

A desktop takes a missing resolver configuration as Go does and asks
loopback nameservers, so the dialer gains a hidden hook,
with_resolver_configuration, that names the file and takes its absence
as a phone does. Only the target check itself is left untested.
Xray config compatibility: warn on inert fields, localhost DNS, proxy sockopt.domainStrategy, Xray-style FakeDNS, TCP http header, up to 32 DNS servers

The pull request's first commit is a copy of #308's first commit, which
is in main with its follow-up and one more commit. Where the two meet,
main's side is taken:

crates/xray-core-rs/src/health.rs, crates/xray-core-rs/src/outbound.rs:
main's files. The pull request's own change to them is two fields that
StreamSettings and StreamCarrier gain, in test initializers; they are
added to the initializers main has now.

docs/config-compatibility.md, docs/xray-core-differences.md: main's text
on re-probes; the pull request's own sections and its domainStrategy
entry are kept. Its section "Fake-IP allocation across restarts"
describes an FNV-1a allocator that does not exist and is left out;
main's "Fake-IP mappings across restarts" stands, after the section
that points at it.

crates/xray-transport/src/lib.rs: the exports of both.

crates/xray-transport/src/dns.rs: the SRV and TXT lookup of a phone
(#280) leaves out the new localhost server, whose platform resolver
answers addresses only.

CHANGELOG.md: the pull request's seven own entries, without its copy of
#308's.
…int unsafe

#319 accepts tlsSettings minVersion, maxVersion, cipherSuites and
curvePreferences with a warning and ignores them. That is what Xray-core
does under a uTLS fingerprint, the default, whose copyConfig drops them,
and on QUIC they have nothing to decide.

With fingerprint "unsafe" Xray-core hands the handshake to Go's
crypto/tls, which applies all four, and the rustls handshake here would
not. Ignored, a minVersion of 1.3 would accept a TLS 1.2 server, and
curvePreferences could not hold the key exchange to a group: a setting
that asks for more would silently give less. A nonempty one fails there,
as every such configuration fails on main today, where the parser does
not know these fields at all.

docs/config-compatibility.md, the capability note behind
docs/config-contract.json and the CHANGELOG entry say so.
#280 has a phone without /etc/resolv.conf ask its dns.servers for an
addressPortStrategy's SRV or TXT record: in turn, four seconds each, and
before every dial of the outbound. #319 raises dns.servers from 8 to 32
entries. Together a dial through 32 servers that do not answer would wait
more than two minutes, and twice that where each UDP answer came back
truncated.

The lookup takes the first eight servers it can ask, the number
dns.servers held until now. Servers it cannot ask, localhost and
DNS-over-TLS among them, are passed over and not counted.
#319 lets the Android and Apple integrations start a profile that lists
Xray-core's localhost server. The core answers it from its bootstrap
resolver, and both integrations create the core with the StaticOnly
bootstrap mode, because the platform resolver would ask the tunnel
itself. So inside the VPN localhost answers the names dns.hosts maps and
no other. A profile whose only servers are localhost started, and the
tunnel resolved nothing.

localhost is now no upstream in either preflight, as fakedns already is
none:

- alone, without fake-IP, the profile is refused. Apple reports it as
  the existing XrayMobileDNSPreflightError.unavailable, whose text now
  names localhost; Android's preparation throws with a message that says
  what to add;
- beside fakedns it leaves Freedom and WireGuard nothing to resolve
  restored names with, so the fake-IP routing check applies, where it
  was skipped because localhost counted as a server;
- beside a server on the wire, and under explicit system DNS servers on
  Apple, nothing changes.

Both READMEs say what localhost answers inside the tunnel.
@aimalygin
aimalygin merged commit 31a9ef5 into main Nov 24, 2026
16 checks passed
aimalygin pushed a commit that referenced this pull request Nov 24, 2026
Main gained #351 and #353 since this branch was cut. Two files conflict
with #353, both because each side adds entries at the same place:

crates/xray-config/src/surface.rs: the root object's keys of both,
burstObservatory beside the inert root apps and fakeDns, with main's
note, which is this branch's plus the sentences on those.

tests/fixtures/config-tooling/cases.json: both appended cases to the
list. Main's ten stay, and this branch's three follow them.
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