With TUN on, every proxy node IP gets a host route through the physical
gateway on macOS and Windows. A node on 127.0.0.1, such as a local
forwarder, then had 127.0.0.1 routed to the Wi-Fi gateway: loopback
broke for every process, the connectivity probe of the core API failed,
the transparent proxy paused, the routes went away, the probe recovered
and the cycle repeated. Loopback nodes are reached without leaving the
host, so collectNodeIPs drops them.
Fixes#2148
nftables 1.0.2, which Ubuntu 22.04 ships, rejects the dstnat keyword on
the output hook ("invalid priority expression value in this context"),
so the DNS redirect table failed to load and the core did not start in
redirect mode. Write the same priority as -101; nftables 1.1.7 lists it
back as "dstnat - 1".
Fixes#2133
In Docker, subscription and RoutingA updates through the core dialled
the default gateway instead of 127.0.0.1, a leftover from when the core
ran outside v2rayA's container. The core now runs in v2rayA's own
network namespace and, unless port sharing is on, listens on 127.0.0.1
only. With host networking the gateway is the LAN router, and on a
bridge network the request only came back to the container when port
sharing was on and the port was published, so updates in the "proxy"
and "port rules" modes failed with connection refused.
Fixes#2139
runtimeAssetDir called os.MkdirAll on $XDG_RUNTIME_DIR/v2raya with mode
0700. When v2rayA runs as root on a system where /run/user does not
exist yet (OpenRC with elogind before any login), that created
/run/user itself as 0700 root:root, and every other user then failed to
get a runtime directory.
The runtime directory belongs to the login manager, so use it only when
it already exists and otherwise put the asset links in the
configuration directory, as a service user without a session already
does. A regular file there is one the user placed, so the lookup now
uses it instead of replacing it with a link to the system copy.
Closes#2092
A VLESS link with security=tls carries its ECH config list in the ech
query parameter. The service dropped it on import, so the stored node,
the generated core config and the exported share link all lost it, and
the server editor dropped it again when a node was edited and saved.
Parse ech into the stored node, pass it to the core as the TLS
settings' echConfigList, and write it back to share links when the
node uses TLS, in the service and in the editor's codec. The service
reads ech from the raw query so that an unescaped "+" in the base64
list stays a "+" instead of becoming a space. The VLESS
encryption half of the original change landed in 3e374af9.
Closes#2093
Auto mode previously trusted the iptables userspace backend alone. On PREEMPT_RT kernels, legacy xtables is unavailable even when the legacy iptables binary is installed. Probe the mangle table read-only and select nft only for the specific missing-table failure. Add regression coverage for backend detection and conservative error handling.
Xray v26.10.31 rejects VLESS with encryption none and no TLS or REALITY on public addresses, so post-quantum encryption strings must reach the core. Parse, generate and export the vless encryption and pqv share-link parameters, and expose both in the server editor with translations for all locales.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
deleteTransparentProxyRules returned before touching the system proxy
whenever no snapshot had been persisted. GetCleanCommands already
handles both cases -- it restores the saved original when a snapshot
exists and falls back to disabling ProxyEnable when none does -- so the
guard only suppressed the fallback that makes the two modes exclusive.
The leftover registry value pointed at 52345, which only the
system_proxy mode ever listens on. Switching back to tun therefore left
proxy-using applications connected to a dead port: their sockets stayed
in SYN_SENT until the process was restarted.
The regression test drives deleteTransparentProxyRules with no snapshot
and asserts the proxy is disabled. Against the previous code it fails
with "the system proxy was never touched"; it passes with this change.
Since v2.4 the dokodemo transparent inbound binds 127.0.0.1 only, so
traffic intercepted by the PREROUTING transparent rules and REDIRECTed
to the interface address (e.g. docker bridge containers) can never
reach it: all bridge-container TCP breaks while transparent proxy is
enabled, a regression from 2.2.x where the inbound listened on 0.0.0.0.
Let the inbound follow the existing 'Allow connections from LAN'
(PortSharing) setting, which the socks/http inbounds
(template_inbound.go) and dns-in (template_outbound.go) already follow.
Default behavior is unchanged (loopback-only with PortSharing off);
with PortSharing on, redirected/forwarded traffic works again.
getsockopt(IP_UNICAST_IF) hands the interface index back in host order while
setsockopt wants it in network byte order, so the second swap in
boundProbeInterface compared 0x01000000 against 1 and the IPv4 cases of
TestBoundDirectDialerSocketOptions failed on Windows.
Revision of the dashboard probe: the UDP fallback used an unmarked, unbound
socket, so its datagram entered the transparent interception the probe is
meant to stay out of and the round trip measured the local stack. Take the
dialer PingWithDialer was given, as the TCP dial already does.
Every core the service starts has outbound traffic counters on, and with them on
xray wraps the underlay connection of a native QUIC outbound in a
*stat.CounterConnection. That wrapper embeds net.Conn alone, so ReadFrom and
WriteTo are hidden and hint/proxy/juicity and hint/proxy/tuic failed their
net.PacketConn assertion before a single QUIC packet left: the node imported, and
then every connection through it died on the spot. Unwrap the stats connection
before the assertion.
A QUIC server listens on UDP only, so the TCP dial the ping made to its port said
nothing and every juicity, tuic and hysteria2 node read TIMEOUT. Keep the TCP
attempt, and when it fails ask the same port over UDP with a QUIC long header
carrying a reserved greased version: a QUIC server answers that with a Version
Negotiation packet (RFC 9000 section 6), and the round trip of that answer is the
latency. A node that answers neither probe is still TIMEOUT; the troubleshooting
pages in the six locales describe that.
xray-core's splithttp range fields (xPaddingBytes, the xmux limits, the
server-checker intervals) parse a plain integer or an "a-b" string, and
reject the object form XHTTPRangeConfig used to serialize to. Any node
with an xhttp range set produced a config the core refused to load with
"Invalid integer range, expected either string of form 1-2 or plain
integer".
XHTTPRangeConfig now carries a MarshalJSON that emits the shorthand (a
plain integer when From equals To, an "a-b" string otherwise) and an
UnmarshalJSON that accepts both forms the core accepts, so generated
configs round-trip. parseRangeString mirrors the core's ParseRangeString
down to its negative endpoints such as "-114-514". Stored settings are
unaffected: the GUI keeps the endpoints as separate query parameters and
nothing parses the generated config back into these structs.
The iptables path wrote each whitelisted CIDR with its own iptables
process. With the mainland China group (about 15,000 CIDRs) a core start
spent minutes on this, and every packet of a direct connection walked
the list linearly.
Load each family into one hash:net set with a single `ipset restore` and
match it with one rule at the old position. Without ipset, write the
rules with one `iptables-restore --noflush` per family; without that,
keep the per-rule commands. Cleanup destroys the sets.