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.
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.
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.
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.
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.
- 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.
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.
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.