98 Commits
Author SHA1 Message Date
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
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
Zakk 2d16a92bbb fix(service): the findings of a cold read of the refactor and the scan fixes
Deleting nodes stored the renumbered connections, the subscriptions and
the servers in three commits; they are one transaction. Without a
catch-all DNS rule the module keeps its own fallback, as every earlier
release did. The login body is capped at 4 KiB, since it is now read
before the one-at-a-time semaphore. The apply-config error names a
failed restore, so every handler's message says whether the previous
value came back. The Windows system proxy reuses a snapshot pending
from an earlier run instead of refusing to start.
2026-09-20 09:59:29 +10:00
Zakk 6d744139d4 fix(windows): the system proxy restores every user profile to its own settings
When elevated, saveProxyState captured the first readable profile's
proxy values and stopped, then the restore wrote those values into
every profile: users with different proxy settings got the first
user's, or none. The snapshot now holds one entry per SID (the current
user under "" when not elevated); restore writes each profile its own
values, a profile written at setup but not captured is left with the
proxy disabled, and a snapshot from an earlier release (one flat
profile) still restores the way it did.
2026-09-20 09:59:29 +10:00
Zakk b1ca0c6edc fix(service): every state-changing handler takes the mutation turn; a truncated link cannot panic the parser
PostImport, PutPorts, PutDnsRules, PutRoutingA, PutGFWList,
DeleteGFWList, PutDomainsExcluded, PutTproxyWhiteIpGroups, PostOutbound
and PutOutbound wrote the store and regenerated the core outside the
mutation turn, so two of them could interleave core restarts with each
other or with a latency test. They take it like the rest.

ParseSSURL and ParseVmessURL sliced past the end of a link shorter than
its scheme prefix ("ss:", "vmess:x"), a panic reachable from a
subscription line.
2026-09-20 09:59:29 +10:00
Zakk 9cae52b9d1 feat!: ShadowsocksR is no longer supported
The core has no ShadowsocksR outbound and the plugin that once served
one was removed in May, so every SSR node has been dead since. Instead
of keeping a protocol that cannot connect: an ssr:// link is refused at
import with "ShadowsocksR is not supported" and the Clash converter
skips ssr entries. A node stored by an earlier release still decodes so
it keeps its place in the list and its group ordinal; it shows as
"SSR (unsupported)", cannot be configured and can be deleted. Both
READMEs list the protocols the current core actually speaks. The GUI
side of the removal is in the GUI change that follows.
2026-09-20 09:59:29 +10:00
Zakk ad509ce51b fix(service): the confirmed findings of four independent backend scans
A custom latency test URL that http.NewRequest rejects made a spawned
goroutine dereference nil and exit the process; the URL is validated
before any goroutine starts and the request error is handled. A
Shadowsocks link whose plugin field has no ";" panicked the parser, and
from the automatic subscription update that goroutine was unrecovered;
the parser accepts it and each updater recovers and logs.

The DNS module took the last non-bootstrap upstream as the fallback
while the template emitted upstreams in rule order with deduplication,
so a catch-all rule anywhere but last, or one whose upstream was
deduplicated, was not the fallback. The template names the fallback in
a new default_upstream field and the module honours it.

PUT /routingA stored the rules without regenerating the running core.
It goes through ApplyCoreConfig like the other config writers, with
restore on failure. UpdateSubscription logged a failed core reload and
answered success; it returns the error. PATCH /subscription joins the
mutation turn.

Subscription fetching retried through a direct connection when the
selected proxy failed, leaking the subscription URL; it returns the
error. Subscription documents are capped at 32 MiB and downloaded
assets at 256 MiB. PUT /gfwList validates the downloaded file as a
geosite list before replacing the working one.

The login handler took its one-at-a-time semaphore before reading the
body, so a client sending headers and no body blocked every login; the
body is read first and the HTTP server has header and idle timeouts.

Share links: a VLESS or VMess link without a numeric port is rejected
at parse time instead of producing port 0; an SSR link with a password
that is not base64 is rejected instead of importing empty; the SIP003
path gets its leading slash prepended, not a trailing one appended.

The macOS system proxy quoted shell arguments with strconv.Quote,
which leaves $(...) live; values are single-quoted. The Windows system
proxy snapshot includes AutoConfigURL, which teardown deleted and never
restored. Latency test responses with a non-2xx status are closed. The
version response carries the docker flag the GUI's port hints read.
2026-09-20 09:59:29 +10:00
Zakk 21948e1fd7 fix(serverObj): HTTP proxy nodes use the core's http outbound; SSR nodes say they are unsupported
Commit 0baefc45 (2026-05-03) removed the plugin layer under
service/pkg/plugin and the code that started a plugin per node, but
left the HTTP and ShadowsocksR node types producing what that layer
consumed: a socks outbound to 127.0.0.1:<plugin port> plus a plugin
chain nothing reads. Every http/https proxy node and every SSR node
imported since then connected to a closed local port.

HTTP and HTTPS nodes now produce the core's native http outbound with
the credentials and, for https, TLS to the server name; they no longer
ask for a plugin port. The core has no ShadowsocksR outbound, so an SSR
node's configuration returns an "unsupported" error the latency test
and the automatic selection already understand; the node still parses,
displays and exports so nothing is lost from the store.
2026-09-20 09:59:29 +10:00
Zakk ccfc5ca096 refactor(service): one apply-config path, NodeRef as a node's identity, typed SQLite stores
Three structural changes that share files, so one commit:

Settings, ports, DNS rules and custom inbounds each carried their own
copy of "store the new value, regenerate the core config, put the old
value back when that fails", and the outbound setting path had no
restore at all. ApplyCoreConfig takes a snapshot function and a store
function and does the sequence once for all five callers; the outbound
setting path restores like the others, and the error names which of
the three steps failed.

configure.Which was the persisted discriminator, the key that locates a
node, and the response row with its latency, link and selected flag at
once. NodeRef {type, id, sub, outbound} is the identity used by the
locator, EqualTo, the connected lists and the group operations; Which
embeds it and keeps the status fields. The JSON stays byte for byte
what it was (a test marshals a fixture before and after), stored
connected lists decode unchanged, and deduplication keys by identity
instead of by the whole row.

db.List* dispatched on "bucket/key" string literals to reach the
servers and subscriptions tables. The bodies are now Servers* and
Subscriptions* functions that configure calls directly; the List*
wrappers remain for the migration.
2026-09-20 09:59:29 +10:00
Zakk f07adaaa8f fix(service): a core that exits during shutdown is not a crash
systemd sends the whole cgroup SIGTERM, so the core died before the
service and was recorded as a crash; the next boot then refused to
restore the proxy ("exited abnormally the last time", discussion
#1922). The signal handler marks the manager as shutting down before
anything else, a core exit in that state keeps the running flag, and
the units use KillMode=mixed so only the service receives the signal.
2026-09-20 09:17:58 +10:00
Zakk d537477a1c fix(service): the findings of a cold read of the upgrade and crash-recovery changes
A SQLite file that an earlier release's migration left empty next to an
intact bolt.db was taken as authoritative; a file without the system
settings a completed migration writes is discarded and the migration
runs again. A database migrated by that earlier release holds its
groups and outbound settings in the two tables the runtime never read;
opening it copies them into the keys it reads, for outbounds that have
none yet.

A start whose host-state recovery failed refused to run, and a start
that rolled back after its own stop tore the host state down a second
time; recovery is logged and retried at the next start, and a rollback
that stopped its process only clears the marker. A system-proxy
snapshot pending from an earlier run blocked every later system-proxy
start; it is reused as the original instead (Linux and macOS here; the
Windows side follows with its per-profile snapshot).

An empty /etc/resolv.conf was backed up as an empty file, which the
restore rejects as truncated; it is written as a marker and restored as
empty. db.Close resets the once so a reopen works.
2026-09-20 09:17:58 +10:00
Zakk 58acf7d40f fix(service): a start that never commits leaves nothing behind on the host
Start persisted running=false, stopped the old core, published the new
process and unlocked, installed the firewall rules, DNS hijack, TUN
routes or system proxy, and only then persisted running=true. A crash in
that window made the next start skip the core and clean only TUN
residue, so redirect rules, a hijacked resolver or the system proxy kept
pointing at a dead listener.

Before it installs anything, Start now stores a host-state marker (the
transparent type, API port and TUN teardown settings) and clears it once
the start commits or is rolled back; startup and the next Start tear
that state down when they find the marker. Every host mutation and the
final commit check that the process they started is still the manager's
current one, so a core that exits during afterStart fails the start
instead of leaving the UI and the store saying running. The system-proxy
implementations persist the user's original proxy settings when they
capture them and restore from that copy when the in-memory one is gone.
A recovery that fails is logged and retried at the next start; it never
blocks the service.
2026-09-20 09:17:11 +10:00
Zakk ae8e5a5047 chore: drop what nothing reaches
Three service packages outside the executable's dependency graph
(common/antiPollution, pkg/util/gopeed, kernel/vmessInfo), a blank
import of miekg/dns the core already imports, the --core-type flag no
code read, the PutAccount handler whose route was commented out, two GUI
API wrappers without a caller, two .SRCINFO files the release regenerates
and an unreferenced runit sample. The workflow path filters watched a
root go.mod that does not exist and the PR build skipped core/.
2026-09-20 09:17:11 +10:00
Zakk 90825094f8 fix(service): hook deadline, gated inbound writes, cleanup on a failed bind, atomic resolv backup
The core hooks ran under exec.Command with no deadline while Start held
the manager's lock, so a hook that never returned left the proxy stopped
and every status read blocked. They now run with the startup timeout as
their deadline in their own process group.

The custom-inbound POST and DELETE handlers did not take the mutation
turn; two concurrent additions read the same list and the last write
won. They take it like every other state-changing handler.

A failed HTTP bind ended in log.Fatal before the deferred cleanup, so
the core and the transparent-proxy rules stayed behind; run() now
returns the error through the same cleanup the shutdown path uses.

The resolv.conf backup was written in place; a crash mid-write left a
truncated file that the next start restored as the original. It is
written to a temporary file, synced and renamed, and an empty backup is
ignored on restore.
2026-09-20 09:17:11 +10:00