1831 Commits
Author SHA1 Message Date
Markson Pigeonzilla Plus 1edc9c868b ci: disable AUR release v2.4.9 2026-07-22 20:29:37 +08:00
Markson Joe Hon e80cab2a59 fix(configure): change default fallback DNS from 8.8.8.8 to 1.0.0.1
Use Cloudflare's secondary DNS (1.0.0.1) as the default fallback
instead of Google DNS (8.8.8.8) for better privacy and reliability.
2026-07-22 14:11:06 +08:00
Markson Joe Hon 62edf08c24 fix(core/dns): increase UDP receive buffer from 512 to 65535
exchangeUDPWithMark used dns.DefaultMsgSize (512 bytes) as the UDP
receive buffer. The query sets EDNS0 UDP size 4096, so the upstream
may respond with up to 4096 bytes. With a 512-byte buffer, UDP
datagram data beyond 512 bytes is silently discarded (UDP datagram
property), causing truncated/corrupted DNS responses.

Fix: use dns.MaxMsgSize (65535) as the receive buffer, matching the
maximum possible UDP datagram size. This ensures large DNS responses
(common with DNSSEC or many A/AAAA records) are fully received.
2026-07-22 14:05:32 +08:00
Markson Joe Hon 9fcbd6a5db fix(core/dns): fix DNS split routing, bootstrap loop, and response corruption
## Issue 1: DNS rule matching logic (MatchAll + OrMatcher)

BuildMatchers flattened all geosite-expanded domains into a single list,
and the old MatchAny used AND logic (all matchers must match). This
made geosite:cn rules impossible to hit (e.g. qq.com and baidu.com
can never match simultaneously).

Fix: introduce OrMatcher to group matchers from the same rule field
with OR semantics, while different field groups use AND. The thousands
of domains from geosite:cn expansion are wrapped in a single OrMatcher
so matching any one domain satisfies the rule.

## Issue 2: Bootstrap self-reference loop (SO_MARK + public DNS fallback)

Bootstrap resolution runs before the DNS listener starts, but iptables
already hijacks :53 traffic:
- bootstrap query to system DNS(:53) → iptables redirects to 127.2.0.17:53
- DNS module not yet listening → connection refused → bootstrap fails
- Domain upstreams (e.g. dns.google) remain unresolved → relies on proxy
- Proxy DNS may re-enter DNS module → loop or REFUSED

Fix:
1. Add SO_MARK=0x80 to bootstrap DNS client to bypass iptables redirect
2. collectBootstrapDns() with 3-tier priority (config > system > hardcoded)
3. Hardcoded fallback includes Alibaba/Tencent/Google/Cloudflare: 13 servers
4. isOwnAddress() filters self-referencing addresses (127.0.0.1:53 etc.)

## Issue 3: handlePacket mutates cached response in-place

m = resp.RawMsg; m.SetReply(msg) directly modifies the *dns.Msg shared
with the cache, corrupting subsequent cache hits. SetReply also forces
Rcode=RcodeSuccess, overwriting NXDOMAIN etc. from upstream.

Fix: Pack/Unpack deep copy before modification; preserve original Rcode.

## Issue 4: Double OPT record causes FORMERR

Three exchange functions called AddECSSubnet BEFORE SetEdns0.
miekg/dns v1.1.72's SetEdns0 always appends a new OPT record without
checking for existing ones, producing a malformed query with two OPT
records.

Fix: call SetEdns0 before AddECSSubnet; use UDP size 4096 in
AddECSSubnet instead of 512 to preserve the size set by SetEdns0.

## Issue 5: localhost upstream skipped in template (template_dns.go)

localhost upstream was continue-skipped during config generation,
making the geosite:private rule reference a non-existent upstream.

Fix: map localhost to 127.0.0.1, keep it as a valid upstream.

## Incidental fixes

- handler.go: remove duplicate :53 in log format (dns.google:53:53)
- response.go: use 4096 instead of dns.DefaultMsgSize(512) for ECS
2026-07-22 14:01:39 +08:00
Markson Joe Hon 1bcd63eb1f fix(iptables): resolve firewall rule bugs and improve cleanup reliability
- Fix nftTproxy.GetCleanCommands using wrong table name ('ip' instead of
  'inet') when IPv6 is disabled, causing nftables table to persist after
  teardown
- Fix legacyRedirect.RemoveIPWhitelist not handling IPv6 CIDRs (always
  used iptables even for IPv6 addresses, causing silent delete failure)
- Suppress errors in ip rule/route del cleanup commands with
  2>/dev/null || true (applies to both legacy and nft TProxy modes)
- Normalize mixed tab/space indentation in nftRedirect's tp_rule chain
  for consistency
2026-07-22 13:09:01 +08:00
Markson Hon 45fabfce39 Merge pull request #1912 from newptcai/fix-sqlite-subscription-server-duplication
fix(db): subscription update duplicates server list on installs migrated from BoltDB
2026-07-22 10:12:38 +08:00
Xing Shi CaiandClaude Fable 5 6ccf42f9e0 🐛 (db): Fix subscription update duplicating servers on migrated installs
- ListSet ignored the DELETE error when replacing a subscription's servers; on installs migrated from BoltDB, outbound_connections rows hold a foreign key to servers, the delete fails, and every update re-inserts the full list alongside the old rows

- Delete referencing outbound_connections rows first (same pattern as ListRemove) and propagate delete errors

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-22 10:03:05 +08:00
Markson Hon f28111364b Merge pull request #1905 from chiyuki0325/fix/empty-sniffing
fix(core): ignore empty sniffing exclusions
v2.4.8
2026-07-20 20:06:17 +08:00
Kirikaze Chiyuki 5d7157503d fix(core): ignore empty sniffing exclusions 2026-07-11 23:09:33 +08:00
Markson Hon 11f052676e Merge pull request #1904 from fnMrRice/fix-subscription-subid-update
fix: update subscription servers by real sub id
2026-07-07 19:34:55 +08:00
fnRice 0f384933cd fix: update subscription servers by real sub id 2026-07-06 10:09:02 +08:00
Markson Hon b6540a0465 Merge pull request #1897 from MarksonHon/main
Fix firewall rule issues, enhance security, and improve proxy handling
v2.4.7
2026-07-02 22:18:22 +08:00
Markson Pigeonzilla Plus 2069b477d4 fix(windows): fix syscall.SetsockoptInt type mismatch on Windows
syscall.SetsockoptInt takes int (Linux) vs syscall.Handle (Windows)
as its first argument. The existing code used int(fd) which fails on
Windows where fd is uintptr and syscall.Handle = uintptr.

Fix: extract a platform-specific setSocketMark(fd uintptr) helper:
  - socket_unix.go (!windows) : calls SetsockoptInt(int(fd), ...)
  - socket_windows.go (windows): no-op (SO_MARK is Linux-only)
2026-07-02 21:32:37 +08:00
Markson Pigeonzilla Plus 1fdeb62bbe fix(windows): fix type mismatch in readRegistryProxyState
k.GetIntegerValue() returns uint64 on Windows, but proxyEnable was
declared as uint32. Add explicit uint32() conversion to fix the
cross-compilation error:

  cannot use k.GetIntegerValue("ProxyEnable") (value of type uint64)
  as uint32 value in assignment
2026-07-02 21:24:31 +08:00
Markson Pigeonzilla Plus 54efcae3ac fix(iptables): fix interface exclusion for OUTPUT path and rename nftables sets
Two fixes for the redirect/tproxy interface exclusion feature:

1. Add missing -o/oifname rules for the OUTPUT path
   - The TP_RULE chain is jumped from both PREROUTING (tp_pre) and
     OUTPUT (tp_out). The existing -i/iifname rules only match the
     PREROUTING path correctly (packets arriving on a given interface).
   - For the OUTPUT path (locally-originated traffic), the input
     interface is always 'lo', so -i never matches the excluded
     interface. Add corresponding -o/oifname rules so that locally-
     originated traffic going out through an excluded interface is
     also bypassed (RETURN before the final REDIRECT/TPROXY action).
   - Applies to both redirect and tproxy modes, legacy iptables and
     nftables implementations, for both IPv4 and IPv6.

2. Rename nftables set 'interface'/'interface6' to 'local_ips'/'local_ips6'
   - These sets store IPv4/IPv6 addresses of local interfaces,
     dynamically maintained by the LocalIPWatcher to prevent proxy
     loops (traffic destined to local IPs returns early).
   - The old name 'interface' was misleading: it suggested it stores
     interface names, but the type is ipv4_addr/ipv6_addr.
   - The rename affects nftRedirect and nftTproxy, including the
     set definitions, chain references (ip daddr @local_ips), and
     AddIPWhitelist/RemoveIPWhitelist nft command strings.
2026-07-02 21:21:18 +08:00
Markson Joe Hon eef675f5f9 fix: persist kernel exit status across restarts and fix geosite DNS resolution
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
2026-07-02 13:51:44 +08:00
Markson Joe Hon 47f1462baf feat: init a new for v2raya core and fix a firewall mistake 2026-07-02 13:10:12 +08:00
Markson Joe Hon d63236d099 fix(iptables): resolve firewall rule issues and security vulnerabilities
- Fix RemoveIPWhitelist table target from mangle to nat in redirect.go
- Fix IsEnabledTproxyWhiteIpGroups() logical operator from && to || in utils.go
- Add whitelist group support for Redirect mode in redirect.go
- Fix data race in LocalIPWatcher by adding sync.Mutex in watcher.go
- Clean up conntrack entries with mark 0x40 on TPROXY teardown in tproxy.go
- Preserve and restore original system proxy state on all platforms (macOS, Windows, Linux)
- Uncomment FakeDNS bypass rules (198.18.0.0/15, fc00::/7) in redirect.go
- Add startup cleanup for residual iptables/nftables rules in transparent.go
2026-07-01 18:08:58 +08:00
Markson Hon 8185b77b8d Merge pull request #1893 from fnMrRice/fix-subscription 2026-07-01 11:55:33 +08:00
fnRice e42174caec fix(db): fix missing remarks and auto_select fields in subscription schema and update relevant queries. 2026-07-01 11:02:34 +08:00
Markson Pigeonzilla Plus cc2a0ca00e fix(ci): use printf instead of here-string to write SSH key without trailing newline
The <<< here-string appends an extra newline to the key file, which can
corrupt OpenSSH private key format and cause 'Bad passphrase' errors.
printf writes the exact content of the variable without modification.
v2.4.6
2026-06-30 03:46:02 +08:00
Markson Pigeonzilla Plus 8cfca15b02 feat: remove GitHub badges from sharing modal and bundle v2raya_core in AUR package
- Remove GitHub stars/forks/watchers badges from modalSharing.vue footer
- Add scoped CSS for modal card-head/card-foot border-radius styling
- Build and install v2raya_core binary in AUR PKGBUILD
- Remove v2ray>=5.0.0 runtime dependency (core is now bundled)
2026-06-30 03:46:02 +08:00
Markson Pigeonzilla Plus e5ed9e3a11 fix(ci): add missing install/aur/tool/ scripts to git tracking
The ssh-add_expect (and related expect scripts) were present on disk
but not tracked by git, causing CI to fail with
'No such file or directory' when running the AUR release step.
v2.4.5
2026-06-30 03:26:09 +08:00
Markson Pigeonzilla Plus 6697d44b18 feat(v2raya-bin): add v2raya_core binary to AUR package
- Add v2raya_core source downloads and checksums for all architectures
  in PKGBUILD and .SRCINFO
- Install v2raya_core to /usr/bin/v2raya_core in package step
- Update deploy_v2raya_bin.sh to compute and substitute v2raya_core hashes
- Fix release workflow: download v2raya_core binaries for hash computation
- Fix release workflow: use heredoc for SSH key to avoid corruption
- Fix release workflow: correct ssh-add_expect script path
2026-06-30 03:15:25 +08:00
Markson Hon f54fbf58d8 Merge pull request #1888 from MarksonHon/main
fix: resolve server deletion failure and settings not persisting
2026-06-29 21:43:40 +08:00
Markson Joe Hon d5ea5e41b2 fix: resolve DNS hijacking issues in redirect and tproxy modes
- Fix routing rule order: move specific dns-in:53→dns-out rule before
  the generic dns-in→direct rule to ensure DNS queries hit dns-out first
- Fix transparent inbound DNS routing: change from direct+geoip:private
  to unconditional dns-out for port 53 in tproxy mode
- Add warning log when CouldLocalDnsListen() fails (port 53 conflict)
2026-06-29 20:40:21 +08:00
Markson Joe Hon 186a463ea4 fix: resolve server deletion failure and settings not persisting
- Clean up outbound_connections foreign key before deleting from servers in ListRemove
- Preserve user's TproxyExcludedInterfaces setting after FillEmpty defaults
- Add cursor: pointer style to proxy group toggle tag in frontend
2026-06-29 20:05:13 +08:00
Markson Hon 06defad587 Merge pull request #1887 from EpLiar/fix/dark-mode-full-height
fix(gui): keep dark background across full page height
2026-06-29 19:18:38 +08:00
EpLiar 8a2bc163f8 fix(gui): extend dark background beyond viewport 2026-06-29 18:30:12 +08:00
Markson Hon 4e366494a3 Merge pull request #1885 from yuexps/main
feat(server/gui): add Unix Domain Socket and BaseUrl support for FnOS & reverse proxies
v2.4.4
2026-06-28 21:30:49 +08:00
yuexps 024e764313 feat(server/gui): add Unix Domain Socket and BaseUrl support for FnOS & reverse proxies 2026-06-28 20:40:07 +08:00
Markson Pigeonzilla Plus bf8aa12ace service: drop ngui and drop v2ray/xray check v2.4.3 2026-06-26 10:07:43 +08:00
Markson Pigeonzilla Plus ff6bf0a43d Remove v2ray/xray core version detection and comparison logic
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.
v2.4.2
2026-06-26 09:44:14 +08:00
Markson Pigeonzilla Plus 05a743ed30 ci: format yaml format v2.4.1 2026-06-25 22:33:26 +08:00
Markson Pigeonzilla Plus a4a6740a5c ci: add GeoIP and GeoSite to Linux packages 2026-06-25 22:32:08 +08:00
Markson Hon 5b364227c2 Merge pull request #1883 from MarksonHon/main
Update xray-core and dependencies, enhance ngui features and fixes
2026-06-25 22:13:25 +08:00
Markson Hon 6bbf135dfb Merge pull request #1884 from yuexps/main
fix(db/sqlite): fix empty subscription servers due to invalid JSON marshal
2026-06-25 22:13:01 +08:00
yuexps eb4f5b0156 fix(db/sqlite): fix empty subscription servers due to invalid JSON marshal 2026-06-25 14:07:12 +08:00
Markson Hon cfe5a69049 chore: update xray submodule to v26.6.1 and replace allowInsecure with cert pinning
- Update core/xray submodule from v1.260327.0 (v26.3.27) to v26.6.1
- Remove deprecated AllowInsecure field from all protocol structs
- Add PinnedPeerCertSha256 and VerifyPeerCertByName fields (service layer)
- Update ngui (Nuxt) frontend with text inputs for new fields
- Update gui (Vue 2) frontend with text inputs for new fields
- Keep existing PinnedSHA256 for juicity (no duplicate)
- Backward compatible: old allowInsecure params silently ignored
- Run go mod tidy to update dependencies
2026-06-20 22:51:17 +08:00
Markson Pigeonzilla a30c757d07 fix(service): reduce lock contention, improve Windows resilience, fix TinyTun races
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
2026-05-22 15:50:14 +08:00
Markson Pigeonzilla a76c965c36 fix(windows): prevent spurious etc\v2raya directory and boltv4.db on startup
On Windows, calling configurev4.IsConfigureNotExists() triggered the v4
library to lazy-initialize using its Linux-default config path (/etc/v2raya).
On Windows, /etc/v2raya resolves to \etc\v2raya on the current drive root
(e.g. C:\etc\v2raya).  The v4 library then called os.MkdirAll to create that
directory and bbolt.Open to create boltv4.db inside it -- neither of which
is intentional or useful on Windows.

v2rayA v4 was Linux-only, so no v4 configuration data can ever exist on a
Windows machine.  Guard the entire v4 migration check with a runtime.GOOS
check to skip it on Windows.

Also extend sanitizeConfigDirForPlatform to catch the relative-path variant
etc/v2raya (without a leading slash) in addition to the existing check for
the drive-relative /etc/v2raya, providing defence-in-depth if V2RAYA_CONFIG
is ever set to such a value.
2026-05-22 13:20:18 +08:00
Markson Pigeonzilla 63434c38f6 fix(windows/tun): resolve frontend stuck in Checking state after enabling Tun
When transparent proxy (TinyTun/wintun) is enabled on Windows, the wintun
driver briefly disrupts all traffic while installing routes.  This caused
two problems:

1. The connectivity monitor fired its first probe too early, before routes
   were fully set up, and received a false network-unavailable result.  This
   stopped TinyTun prematurely and set networkPaused=true, leaving the
   frontend's status tag stuck on the Checking spinner indefinitely.

2. The frontend's /touch request in node.vue created() could fail during
   that same disruption window, making the component stay in the loading
   state with no retry.

Fixes:
- connectivity.go: add a 5-second startup delay before the first probe so
  that wintun has time to finish installing routes.
- node.vue: replace the single /touch call with a retry loop (up to 3
  attempts, 2 s apart) that handles both network errors and non-SUCCESS
  responses; always sets ready=true after the last attempt to unblock the UI.
- App.vue: call syncLatestNodeOverview() on every WebSocket (re)connect so
  the running state is refreshed even if a WS message was missed while the
  connection was down.
2026-05-22 13:20:06 +08:00
Markson Pigeonzilla 3956538ff4 chore: remove yarn.lock 2026-05-22 13:19:55 +08:00
Markson Hon 942afc75c3 chore: add root yarn.lock 2026-05-11 23:38:32 +08:00
Markson Hon a86b134866 feat(ngui): unify header interactions and improve i18n and page resilience 2026-05-11 23:38:32 +08:00
Markson Hon 2c20e934e0 feat(gui): add waiting-network state and improve dark-mode node status styles 2026-05-11 23:38:32 +08:00
Markson Hon 18daf4f6cc fix(core): enable UDP support for Trojan and TinyTun 2026-05-11 23:38:32 +08:00
Markson Hon 72dad35557 feat(service): pause transparent proxy on network loss and report state 2026-05-11 23:38:32 +08:00
Markson Hon baf3db6039 feat(tuic): add native TUIC outbound support 2026-05-11 23:38:32 +08:00
Markson Hon 3a02ad2933 chore(build): use env-based bash shebang 2026-05-11 23:38:32 +08:00