110 Commits
Author SHA1 Message Date
Zakk 53cc9a11f5 fix(tun): leave loopback proxy nodes out of the physical host routes
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
2026-11-20 18:00:48 +11:00
Zakk f0924d0952 fix(iptables): spell out the DNS redirect priority for older nftables
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
2026-11-19 22:20:21 +11:00
Markson Hon ff59fc8757 Merge branch 'main' into feat/subscription-node-dns
Signed-off-by: Markson Hon <50002150+MarksonHon@users.noreply.github.com>
2026-11-18 19:29:42 +08:00
2436378140@qq.com 8fee133019 feat(subscription): resolve node domains with a per-subscription DNS 2026-11-17 11:54:14 +08:00
Mikhail Levin 9c7b87fba6 feat: expose native group strategies with group-scoped fallback 2026-11-15 23:16:39 +03:00
Mikhail Levin aab11c05a5 feat: add per-subscription update policies and explicit recovery consent 2026-11-15 14:56:04 +03:00
Markson Hon 2dd4d683cc Merge pull request #2057 from wywywywycloud/fix/openwrt-lan-bridge-tproxy
fix(openwrt): include LAN bridges in TPROXY by default
2026-11-13 08:51:46 +08:00
Markson Hon 0efd6759df Merge pull request #2118 from Zakkaus/vless-ech
fix(vless): keep the ECH parameter in share links and the core config
2026-11-13 07:02:53 +08:00
Zakk 4935c04b82 fix(asset): do not create a missing XDG runtime directory
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
2026-11-13 02:16:34 +11:00
Hocassian 20ad8905d4 fix(vless): keep the ECH parameter in share links and the core config
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
2026-11-13 02:15:41 +11:00
HougeLangley 7f03ed9953 iptables: fall back to nft when legacy mangle is unavailable
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.
2026-11-05 17:13:51 +08:00
Markson GuGa BeyondandCopilot 3e374af969 feat(vless): support encryption and REALITY ML-DSA-65 verify key
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>
2026-11-02 10:58:07 +08:00
Markson Hon 1ee48148dd Merge pull request #2086 from miaomiaoyaoqimiaomaoxian/fix/system-proxy-mutual-exclusion
fix(v2ray): keep system proxy and tun mutually exclusive
2026-10-16 07:46:23 +08:00
miao db38d18595 fix(v2ray): keep system proxy and tun mutually exclusive
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.
2026-10-15 11:41:17 +08:00
ILIKEFUTANARI 6d6c1c117f feat: separate DNS service and interception modes 2026-10-09 17:43:48 +08:00
ILIKEFUTANARI e010d19a5d feat: add DNS interception opt-out 2026-10-09 17:43:48 +08:00
big-head-pigeon 5a1b0c4213 fix(kernel/v2ray): transparent inbound follows PortSharing like socks/http/dns-in
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.
2026-10-04 15:06:25 +08:00
Markson Hon a8334a2e71 Merge pull request #2069 from wywywywycloud/fix/openwrt-nftables-dns
fix(openwrt): install native nftables DNS redirects
2026-10-02 08:28:33 +08:00
Mikhail Levin 5ec0451a66 fix(openwrt): limit fatal DNS redirect setup to Linux proxy modes 2026-10-01 13:05:11 +03:00
Markson Hon 94693ebbe1 Merge pull request #2067 from himeer/feature/xhttp-range-json-shapes
Kernel: write xhttp ranges in the xray-core's form, import them from 3x-ui links
2026-10-01 11:34:57 +08:00
Vladimir E. Tkachuk 86f57fb05d fix(kernel): drop XHTTP ranges the core would panic on 2026-10-01 12:37:48 +10:00
Mikhail Levin 392b1c7942 fix(openwrt): make nft DNS redirect idempotent and preserve legacy startup 2026-10-01 01:01:05 +03:00
Vladimir E. Tkachuk 1710a70741 fix(kernel): model the core's XHTTP padding fields 2026-09-30 15:29:03 +10:00
Mikhail Levin 75ac824b43 fix(openwrt): install native nftables DNS redirects 2026-09-29 21:10:54 +03:00
Vladimir E. Tkachuk 7027788e6a fix(kernel): let an explicit false win over the 3x-ui blob 2026-09-29 20:42:19 +10:00
Vladimir E. Tkachuk ccea5d1392 feat(kernel): import XHTTP tuning from 3x-ui style vless links 2026-09-29 15:52:33 +10:00
Vladimir E. Tkachuk 6162730f64 fix(kernel): write xhttp range fields in the xray-core shorthand form
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.
2026-09-28 21:24:10 +10:00
Mikhail Levin cef8fbc939 fix: bind dashboard probes to TUN egress on macOS and Windows 2026-09-25 21:34:00 +03:00
Mikhail Levin 58af604a99 fix(openwrt): clarify bridge exclusions and retire obsolete flag 2026-09-25 20:26:43 +03:00
Markson Hon bdbc305e97 Merge pull request #2052 from Zakkaus/iptables-ipset
fix(iptables): match the transparent-proxy whitelist with ipset
2026-09-24 15:13:50 +08:00
Zakk 8b818ffc41 fix(iptables): match the transparent-proxy whitelist with ipset
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.
2026-09-24 01:23:08 +10:00
Zakk 0de4b2c4a4 fix: refuse Shadowsocks links whose cipher the core does not accept
A Shadowsocks link with a stream cipher (rc4-md5, aes-128-cfb, aes-256-cfb,
chacha20-ietf) or with none/plain imported without complaint and failed at
core start with "unknown cipher method", so the user saw a broken core rather
than a refused node. xray-core dropped the stream ciphers in 2021 and never
took none or plain in the shadowsocks outbound; these are also the ciphers
ShadowsocksR providers hand out.

ParseSSURL now refuses them with LINK_UNSUPPORTED_CIPHER, which NewFromLink
passes through instead of calling the link malformed; subscriptions skip such
nodes with a warning as they skip other unparseable ones, and the Clash
importer goes through the same parser. The node form drops none and plain and
offers xchacha20-ietf-poly1305, which the core does accept. The six locales
carry the message, and the quick-start pages say which ciphers work.
2026-09-23 21:01:56 +10:00
Markson Hon 7671a8a795 Merge pull request #2047 from Zakkaus/status-rfc3339
fix(service): a subscription's update time carries its zone
2026-09-22 17:55:06 +08:00
Zakk 8a5b3f3f99 fix(service): a subscription's update time carries its zone
NewUpdateStatus wrote the service's local time without a zone
("2006-1-2 15:04:05"); the browser read it as its own local time, so with the
service in UTC (a container, a router) and the browser in UTC+8 the dashboard
said "updated 8 hours ago" right after an update, as if the update had not
happened (#2046). The stamp is RFC 3339 now; dayjs reads the offset on both
pages, and stamps written before this keep reading as they did.
2026-09-22 18:25:03 +10:00
Zakk 304594eef9 fix: what a read of main since 2.5.5 turned up
- A page's late /touch response no longer writes the store after the page is
  gone: useNodes marks itself disposed with its scope and apply() drops the
  result, so leaving Subscriptions for Proxies while a request is in flight
  cannot hand a batch action a stale member list.
- The dashboard's subscription card links go to the Subscriptions page, not
  Proxies, which no longer lists subscriptions.
- Page shortcuts stay quiet while a menu is open (Escape dismissed the batch
  menu and cleared the selection in one stroke) and treat checkboxes as
  buttons, not text entry; the node checkboxes drop a keydown.stop that only
  served the row activation that is gone.
- Submissions in flight are not started twice from the new Enter shortcuts:
  GFWList update, subscription save, excluded domains, whitelist IPs.
- Choosing Documentation in the phone's app bar menu closes the menu.
- The Clash importer no longer writes allow_insecure into anytls and tuic
  links (nothing reads it since 1c392550); the core's example configs drop the
  stale key.
2026-09-22 14:58:28 +10:00
Zakk 1c39255010 fix: TUIC, Juicity and AnyTLS no longer skip certificate verification
v2rayA dropped allowInsecure years ago: VMess, VLESS and Trojan links carrying it
are parsed and the flag ignored, and a self-signed server is reached by pinning
its certificate. The three native protocols added in May brought the switch back
in their own config, service objects and forms. It goes everywhere: the core's
dialers verify or pin (the proto field 5 is reserved), the service no longer
parses, stores or exports allow_insecure for them, the forms lose the switch,
the codec ignores the parameter, and the quick-start docs say so in six locales.
Certificate pinning stays as it was.
2026-09-22 02:40:22 +10:00
Markson Hon 5079fc75b1 Merge pull request #2033 from Zakkaus/leftovers-1 2026-09-21 10:48:33 +08:00
Zakk a9abbe0fe6 feat: the Multiplex setting applies to VMess outbounds
Settings had a Multiplex switch and a concurrency field, validated and stored,
that no template code read. VMess outbounds get mux.enabled and the
concurrency when the switch is on, which is what the help text promised
("vmess only"). The core accepts the result (run -test).
2026-09-21 12:44:14 +10:00
Zakk ba24a94719 fix: names and descriptions after the bundled core
Strings that still named v2ray-core, "v2ray / xray" or a wiki: six locales
(the core is v2raya_core; the invalid-service message, the SS plugin help,
the transparent-proxy hint, the TUN example, the custom inbound tag hint),
the --v2ray-bin, --core-startup-timeout and --plugin-manager descriptions
and their copies in the OpenRC confd files (the plugin manager is called
with --stage=parse|configuration, --link and --v2raya-confdir, not with
life-cycle stages), two comments that forbade or excused the current design,
the package descriptions that listed SSR, the AUR Go minimum (go.mod says
1.26), the systemd Documentation= and the installer's shortcut that pointed
at the wiki and the docs site, and the README sentence on network requests,
which left out the weekly release check and the NTP query on VMess failure.
2026-09-21 12:44:14 +10:00
Zakk 0872d7db62 chore: remove what nothing uses any more
copyfile, the empty ports/ss.go stub, parseDnsAddr and DnsRouting (the DNS
config is generated for the core's module now), the Inter font and the
switch-menu icon of the old GUI, the docs-site dispatch workflow (the site is
retired; the docs are in the app), the unused v2ray_arch in the docker helper,
the root .gitignore rule for a web directory that moved, and the .dockerignore
patterns for binary and test names that no longer exist. The skipped
TestFillEmpty asserts what FillEmpty does instead of what it once did.
2026-09-21 12:44:14 +10:00
Zakk 35505baed5 fix: the bound-device option needs Linux 5.14 (SO_NETNS_COOKIE), and the docs say it is off by default 2026-09-21 12:28:42 +10:00
Zakk 01df00559b fix(service): the bound-device flag sits with the transparent-proxy options and names its kernel requirement
--redirect-respect-bound-device was the first field of Params, so it led
--help, --report config and the /etc/default/v2raya the packages generate
from it; it now follows --ipv6-support. Its description says what it does
in the user's terms (SO_BINDTODEVICE, NetworkManager's connectivity
checks) and what it needs (kernel 5.7, cgroup v2). When SO_NETNS_COOKIE
is missing the error says the kernel is too old instead of ENOPROTOOPT.
cilium/ebpf moves to the direct require block, as go mod tidy puts it.
2026-09-21 12:23:51 +10:00
Markson Hon 72465a8873 Merge pull request #1954 from Laceprndpm/fix/redirect-bound-device
feat(redirect): add opt-in BPF bypass for device-bound TCP sockets
2026-09-21 08:29:10 +08:00
RocketDev 0104fa8405 feat: display geosite date if gfwlist absent
Currently, if system /usr/share/v2raya/geosite.dat is used, v2raya will
not post error, but will display "none" for local GFWList date.
Since v2rayA reads this compatible file, we should display a date for
it, so that user is not confused.

Assisted-by: GPT-5.6-terra
2026-09-21 03:29:57 +08:00
Zakk 74277851bb fix(dns): the service, the module's bootstrap and the hijacked resolv.conf follow the DNS rules' direct upstreams
Node hostnames, upstream hostnames and the service's own lookups (subscriptions,
latency tests) were resolved by hard-coded public resolvers (223.5.5.5, 119.29.29.29,
...) whatever the DNS rules said; the second nameserver written into the hijacked
/etc/resolv.conf was hard-coded too. directDnsServers() now collects the plain
udp/tcp IP upstreams of the rules with the direct outbound, and

- resolv.PreferredServers hands them to the service's resolver before its public list
- the module's bootstrap_dns is the system's resolvers plus those upstreams
- the upstream for node hostnames is the first of them
- HijackResolv writes the first port-53 one as the second nameserver, and so does the
  restore when no backup exists

getSystemDnsServers reads the backup while resolv.conf is hijacked, so a restart
no longer hands the module its own listener as bootstrap.
2026-09-20 23:23:08 +10:00
Zakk cc60098633 feat(dns): DNS over HTTPS upstreams, direct and through the proxy; DNS over TLS keeps its server name
The DNS module spoke UDP, TCP and DNS over TLS. An https:// upstream is
now an RFC 8484 POST through an http.Client the upstream keeps between
queries; the TLS handshake is done in the dialer so the server name is
the upstream's hostname while the address dialled is what bootstrap
resolved for it — the module cannot ask itself for its own upstream's
address. A direct upstream dials on a marked socket, as the other
protocols do; a proxied one dials through the xray dispatcher, so the
request leaves through the chosen outbound.

Two things the dispatcher path had wrong for tls:// upstreams: it sent
plain DNS over TCP whatever the protocol, and bootstrap replaced the
hostname by an IP without keeping it, so TLS had nothing to verify
against. The hostname is kept as ServerName on the upstream, the
dispatcher path wraps the connection in TLS for tcp-tls, and the direct
miekg client verifies the same name. The service adds https and tls
hostnames to the bootstrap list, which it skipped for every scheme
address before. CheckDnsUpstream accepts https:// URLs with a host and
still refuses quic://.

Verified on the VM with a raw UDP client against the module, names not
in its cache: https://dns.google/dns-query direct (bootstrap dns.google
→ 8.8.8.8, a v2raya_core connection to 8.8.8.8:443), https://1.1.1.1
/dns-query via proxy (the connection goes to the proxy server's :443),
tls://dns.google via proxy (rewritten to 8.8.8.8:853, TLS verified as
dns.google) and tls://1.1.1.1 direct all answer; the previous rules
restore unchanged. A unit test runs the DoH client against an httptest
TLS server.
2026-09-20 18:53:48 +10:00
Zakk c1e65ca44a fix(dns): refuse DoH and DoQ upstreams on save instead of failing every query
The DNS form's placeholder offered https://dns.google/dns-query, the
service turned https:// into protocol "https" and quic:// into "quic",
and the DNS module handed those to a miekg/dns client, which speaks udp,
tcp and tcp-tls only. Saving succeeded and every query on that rule then
failed, visible only in the log.

CheckDnsUpstream in kernel/v2ray accepts an address, tcp://, udp:// and
tls:// (DNS over TLS, which the module does support) and rejects https://
and quic:// with a message that names the alternatives; PutDnsRules
returns it as a 400 before anything is stored. The placeholder in the six
locales shows the supported forms and the docs say which schemes work.

Verified on the VM: https:// and quic:// rules come back BAD_REQUEST with
the message, tls://1.1.1.1 saves and the module logs
addr=1.1.1.1:853 protocol=tcp-tls; the previous rules restore unchanged.
2026-09-20 18:44:58 +10:00
Zakk 17e6c48dff fix(service): a user without a session keeps its assets in the configuration directory
The core's asset directory defaulted to v2raya/ under the XDG runtime
directory, and the lookup created the links there with xdg.RuntimeFile.
A service user has no session, so /run/user/<uid> does not exist and the
user cannot create it; the first lookup failed with "could not create any
of the following paths: /run/user/1001/v2raya" and the start died, while
geoip.dat and geosite.dat sat in /usr/share/v2raya. That is every
OpenRC v2raya-user.<user> instance and any lite start outside a desktop
session. When the runtime directory cannot be made, the configuration
directory, which the process owns, holds the links instead.

Verified on the Gentoo VM: /etc/init.d/v2raya-user.tuser starts, reports
lite and links /usr/share/v2raya/*.dat into ~/.config/v2raya.
2026-09-20 16:08:25 +10:00
Laceprndpm 6ef28019c5 feat(redirect): add opt-in BPF bypass for device-bound TCP sockets
Inspect bound_dev_if at connect time, preserve existing socket marks and
add the existing 0x80 bypass bit before REDIRECT. Scope the guard to the
manager's network namespace and release real BPF links on teardown.

Include opt-in isolated cgroup tests and document the experimental status,
unverified native behavior, performance work, and connect-time limits.
2026-09-20 13:16:56 +08:00
Zakk 61df71b0a4 fix(serverObj): two link shapes from the discussions
A VLESS or VMess link with type=raw — xray's new name for the tcp
transport — was rejected with "unexpected transport type: raw"
(discussion #1999). A vmess JSON whose port, aid or v is a number was
dropped as "not a JSON object"; v2rayN writes strings but most other
exporters write numbers, and one public subscription lost 152 of its
1625 nodes to it (#1957).
2026-09-20 09:59:30 +10:00