Three endpoints answered FAIL for something the caller asked for and got:
- an up-to-date GFWList came back as "could not update GFWList: latest version
is …. GFWList is up to date", because the check returned an error;
- deleting the GFWList when it was already gone returned the raw
"remove …: no such file or directory";
- the update check said "failed to get latest version from Package file: 1".
The up-to-date case is now a sentinel error the controller turns into a
success carrying alreadyUpToDate, deleting what is already gone succeeds, and
the two package-index messages say what was missing. "which can not be nil"
also became a sentence about the request.
A custom inbound port was open to anyone who could reach it, and older v2rayA
versions did offer authenticated inbounds, so users who relied on them had no
replacement (v2rayA/v2rayA discussions #1894, #1907).
CustomInbound carries optional credentials, which become the inbound's account
list. Half a credential pair is rejected: it would silently leave the port open.
A client that predates the kind field sends only the URL, so an http(s) link
had to be guessed. Guessing "subscription" is right for every address a
provider hands out, but it took away the bare proxy link 3fd0e882 had added:
credentials, host, port and nothing else cannot be a subscription address, so
that one shape goes back to the server importer.
Also let the config loader ignore every -test.* flag instead of only -test.v,
so the packages that reach it can run their tests at all.
Three gaps the settings rollback left open:
- adding or deleting a custom inbound stored the new list and then reloaded the
core; a core that refused the list stayed stopped with the rejected inbound
stored, so every later start failed too;
- a settings save that flipped ip forwarding left the kernel flag on the new
value after the setting itself was rolled back, so the stored setting and the
host disagreed;
- the rollback reported "the previous ones are back" even when restoring the
setting or restarting the core had failed as well.
The session secret now retries persistence instead of accepting a failed store
for the life of the process, and an unreadable secret row is no longer
overwritten with a fresh one, which would have signed out every session.
UpdateSetting stored the new setting before asking the core to reload it. When
the core refused the new config, the controller stopped the core and left the
rejected setting in the database, so the proxy was down and the next save
reported success while nothing was running.
Snapshot the setting before storing it, and on a reload failure put it back and
restart the core with it. The response now carries INVALID_CONFIG and the
reason the core gave.
The GUI shows backend error text as is, so errors were never localized.
common.Coded wraps an error with a stable code and scalar parameters;
ResponseError adds "errorCode" and "params" next to the unchanged English
"message" when the chain carries one. Thirty-two user-facing errors are
coded (no server selected, core start failure, port occupied, malformed
link with protocol and detail, subscription fetch failure with host,
server/subscription not found with ids, bad request with the field,
credentials, session, admin, request in progress, GFW list missing,
invalid config, asset download, transparent setup, mux range, custom
inbound fields). logError now keeps the error chain instead of
flattening it. Messages, status codes and control flow are unchanged; the
two strings the GUI matches on stay as they are.
tools_test.go becomes an external test package so the common tests
compile again; its FillEmpty equality assertion, which never ran before,
is skipped with the reason.
The entry page names hashed assets that disappear on every upgrade. It
was served with "public, must-revalidate" and no max-age, which browsers
may treat as heuristically fresh, so a cached copy loaded a bundle that no
longer existed and the GUI came up blank until a hard refresh. no-cache
forces revalidation; the ETag keeps it a 304.
Errors that reach the GUI were written for the log: "ResolveURL failed:
invalid parameters", "httpGetUsingSpecificClient: response is nil",
"LocateServerRaw: invalid TYPE", "bad request", "illegal base64 data at
input byte 18". Reword the messages that can reach a user so each names
the input that was rejected (link scheme, missing password, port, server
id, request field), states the expected form for malformed input, drops
Go function names, keeps the %w chain so errors.Is/As still work, and
never echoes passwords, tokens or full share links (hosts only).
Messages the GUI string-matches ("invalid config", "the last request is
being processed") are unchanged.
UpdateSubscription snapshotted the whole subscription list before the
network fetch and wrote the stale struct back by index, reverting edits
made during the fetch; re-read the subscription afterwards and replace
only Servers, Status and Info. SelectServersFromSubscription disconnected
with clearOutbound=true per node, wiping every connection of the proxy
group and restarting the core once per node; it now removes only this
subscription's nodes in one replacement. The HTTP latency test bound its
per-node SOCKS inbounds on 0.0.0.0 without auth; bind loopback unless
PortSharing is on, and restore the previous core when the test core fails
to start. SetPorts skipped the API port and never range-checked; check all
six ports. Connect and ReplaceOutboundConnections treated an existing but
empty previous list as something to restore, which OverwriteConnects
turns into a no-op, so a failed selection stayed persisted; clear the
group in that case.
Adding or deleting a custom inbound only wrote the database: the running
core kept its old inbounds until the next unrelated restart, and a port
that collided with the configured socks5/http/pac/vmess/api ports was
accepted and broke the next core start. Reject out-of-range and colliding
ports with a message naming the port, and regenerate the config when the
core is running.
ParseTuicURL read the certificate pin and name verification only as
pinnedPeerCertSha256/verifyPeerCertByName while the GUI form and other
clients emit pinned_peer_cert_sha256/verify_peer_cert_by_name, so a pin
typed into the form was dropped. ParseTrojanURL read host only for the
trojan-go scheme although ConfigurationMC uses it as the WebSocket Host
header for plain trojan as well.
ImportSubscription redeclared err with := inside the block, so a failure
of AppendSubscriptions was assigned to the shadow and the function
returned nil.
PutSetting decoded the request into a zero Setting and persisted the whole
struct, so the fields the settings dialog never sends (dnsCacheEnabled,
dnsPrefetch, dnsNegativeCache, the per-protocol backends) were saved as
false or empty on the first Save and the DNS cache silently switched off
with no control in the GUI to switch it back. Decode over the stored
setting so absent fields keep their value.
DeleteWhich walked cssRaw.Get() while removing entries from cssAfter,
which was the same slice header over the same backing array. After a
non-tail removal the next touch saw the shifted list with a stale
duplicate at the end: the same Which pointer was decremented twice or
Disconnect ran on it, and cssAfter[:i] with the old length panicked with
slice bounds out of range. Work on a copy and iterate that copy.
Import accepted which.TYPE == subscriptionServer for a modification but
then called configure.SetServer(ind), which replaces the standalone
server at that index; the subscription node itself stayed unchanged and
an unrelated server was overwritten. Write the node back through
SetSubscription with bounds checks on sub and index.
- time.Ticker.Reset panics on a non-positive duration; a stored auto-update
interval of 0 crashed every start (pre_update.go) and every settings
save. Route both tickers through configure.IntervalHours, which falls
back to one hour.
- The auto-updater indexes a startup snapshot; a subscription deleted
while it runs panicked out of range in a goroutine and took the daemon
down. UpdateSubscription now refuses an index that no longer exists.
- ResolveSubscriptionWithClient applied its 30 s timeout floor to a copy
it never used, accepted HTTP error pages as an empty node list, and
returned zero nodes without error, so UpdateSubscription replaced the
stored list with nothing on a provider 403/5xx. Use the copy, reject
status >= 400 and empty results.
- PutOutbound wrote an error response and then fell through to the
success response, producing two JSON bodies.
- TestHttpLatency passed nil entries (servers it could not locate) to
addHosts, which dereferenced them; skip them.
- ReqCache read the per-request mutex map after releasing the lock that
guards writes to it (a fatal concurrent map access under load).
- The websocket writer ran one goroutine per message box on a single
gorilla connection, which forbids concurrent writes; serialize them.
Connect stored the requested Which with AddConnect before generating the
core config. A request whose body did not bind to a valid selection (empty
_type, out-of-range id) was persisted anyway; UpdateV2RayConfig then
failed with "LocateServerRaw: invalid TYPE", and because the deferred
restore ran only while the core was running, and only when the group had
a previous list, the bad entry stayed in the database and every later
connect and core start failed with the same error.
Locate the server first and refuse anything that cannot be found, and on
failure restore the previous list (or clear the group when there was
none) regardless of whether the core runs.
Import guessed from the URL scheme. Commit 3fd0e882 added http and https
to the server prefixes so that http proxy nodes were not stored as
subscriptions, and from then on every http(s) subscription address was
parsed as a proxy node and failed with "ResolveURL failed: invalid
parameters".
POST /api/import now takes "kind": "server" or "subscription". Import is
split into ImportServer and ImportSubscription; the old scheme-guessing
Import remains for requests without kind, with http and https back on
the subscription side as before 3fd0e882. The v4 migration calls the
explicit functions since it knows which list each address came from.
The GUI side (a server link / subscription address toggle that sends
kind) is in the gui branch.
A subscription that serves a Clash config went through the line parser,
which picked up a stray URL from the rules and produced a "successful"
subscription holding one bogus http node. Detect a YAML body with a
proxies list and map each proxy onto the share link v2rayA already parses
for its type: anytls, trojan, vless, vmess, ss (obfs and v2ray-plugin),
ssr, hysteria2, tuic, socks5 and http. Unsupported types are counted in
the log; a config with no usable proxy fails the import instead of
storing an empty subscription.
Add 'http' and 'https' to supported prefixes in Import() so HTTP/HTTPS links are recognized as server links rather than subscriptions. Prevents single http://... nodes from being stored as subscriptions.
- Providers like Just My Socks keep node names and credentials stable but rotate IPs, which defeats the endpoint match; fall back to name matching guarded by name uniqueness on both sides
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Fall back to protocol+host:port matching when the exact share URL no longer matches (providers rename nodes on refresh)
- Reload the running core after a remap so the new server config takes effect immediately
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
core: fix geosite.dat parsing in DNS resolver
- Replace broken GeoSiteList unmarshal with correct varint-length-delimited
stream parser matching xray-core's format
- Add result caching to avoid re-reading the file per tag expansion
service: persist kernel exit status for proper state restoration
- Add LastKernelExitStatus (running/stopped/crashed) to DB
- Set 'running' on graceful shutdown while kernel is active so it
is automatically restored on next startup
- Set 'stopped' when user explicitly stops the kernel via API
- Set 'crashed' when the kernel exits unexpectedly
- Check saved status at startup and log appropriate messages
- Expose lastKernelExit field via GET /api/version for the frontend
Since v2rayA now exclusively uses the v2raya_core binary, simplify or
remove all logic that detected, compared, or branched on different
core types (v2ray, xray, merged).
- Remove CheckCoreVersion, CoreVersionMismatchError, and the
CoreVersion check in StartCoreProcess — core v2raya version
comparison is no longer needed.
- Remove DetectCoreTypeByBinaryName and the Unknown/V2ray/Xray/Merged
variant aliases. The only remaining Variant constant is V2rayaCore.
- Simplify GetV2rayServiceVersion: drop all CoreType/env-config
detection and variant mismatch verification. The function always
returns V2rayaCore and the version string from the binary.
- Simplify CheckV5 / isVersionSatisfied to return only an error,
dropping the unused Variant return value.
- Remove variant-branching in Shadowsocks and Trojan Configuration
methods — both always use the MT (Xray-compatible) path.
- Remove the CheckCoreVersion call from version.go and hardcode
coreVersionValid/ variant in the API response.
- Drop the now-unused where import from shadowsocks.go and trojan.go.
ProcessManager.Start() now runs resolv/GFWList checks before acquiring
m.mu and defers afterStart (transparent-proxy setup, DNS, TinyTun,
post-start hook) to after the lock is released, eliminating multi-second
lock holds caused by DNS lookups and external hook commands.
TinyTun:
- Fix cancel/stopping ordering race in startTinyTun: assign the new
cancel func before clearing the stopping flag so a concurrent
stopTinyTun always sees the correct cancel
- Resolve proxy-node hostnames concurrently with sync.WaitGroup instead
of sequentially, reducing config-generation latency
- stopTinyTun now waits up to 5 s for the process to exit via a done
channel closed by the monitor goroutine after cmd.Wait() returns
Windows service lifecycle:
- cleanupResources enforces a 30 s hard timeout and adds panic recovery
- HTTP router is shut down before the core process on service stop
- router.Run uses an explicit http.Server + Shutdown() for graceful teardown
Connectivity monitor:
- Extend startup grace period to 15 s on Windows (5 s elsewhere)
- Replace fixed 30 s re-check ticker with exponential back-off (30/60/120 s)
- Probe TinyTun availability via TCP dial to the SOCKS5 port instead of HTTP
Platform guards:
- resolv.CheckResolvConf/WriteResolvConf: no-op on non-Linux
- DNS-hijack operations (NewResolvHijacker, HijackResolv, etc.): Linux-only
Add a safe statigz handler wrapper that validates fs roots and recovers from FileServer initialization panics.\n\nUse a generic embedded route registrar for /static and /_nuxt with fallback candidates, so both gui and ngui layouts avoid startup panic: open .: file does not exist.
- Wrap /_nuxt/* route registration in fs.Sub() error check
- When _nuxt directory is absent (gui build without ngui),
skip route registration entirely instead of passing an invalid
FS to statigz.FileServer which caused panic on Open('.')
- Add build-with-ngui.sh (Linux) and build-with-ngui.ps1 (Windows)
using pnpm + nuxt generate for ngui frontend
- Configure nuxt.config.ts with nitro.output.publicDir pointing to
service/server/router/web/ for go:embed compatibility
- Add /_nuxt/* route in ServeGUI() to serve Nuxt 3 static assets
alongside existing /static/* route
- Both build systems coexist: build.sh for gui, build-with-ngui.sh for
ngui, Go router handles both
- Add MaxEarlyData and EarlyDataHeaderName fields to WsSettings for WebSocket Early Data support
- Add MultiMode, IdleTimeout, HealthCheckTimeout, PermitWithoutStream, InitialWindowsSize fields to GrpcSettings
- Add WireGuardSettings and WireGuardPeer structs for WireGuard outbound configuration
- Add wireguard to supported import protocol prefixes
- Parse and export WebSocket Early Data and gRPC MultiMode parameters in V2Ray server object
Squashed from:
- 856a3730 ci: update go to 1.26
- 191be38f tun: fix IPv6 address under win
- 3ca4d5cd windows: v2rayA should read win env like %temp%
- 48a84438 windows: v2rayA should start after modified PATH
- c87bbf62 fix .exe ext-name under windows
- 614bfe1c dns: fix a error about dns format
- 991319ff pre.go: don't create C:\etc
- 9f31b39c translated all comments to English
- aaa269f7 try to fix Tun DNS
- 25c84ad9 面向云代理会话的 VS Code 中的检查点
Co-authored-by: Markson Hon <markson@nixos.local>