1177 Commits
Author SHA1 Message Date
fanyang 177107eef9 fix(socks5): prefer IPv4 DNS answers for the IPv4 data plane (#2880)
Related to #2379. This affects proxy-side resolution (socks5h://). Clients using socks5:// resolve locally; an IPv6 literal is still rejected by the data plane.
2026-11-28 14:25:51 +08:00
KKRainbow 6f3e159d97 fix(version): place the dirty marker after the commit date (#2909)
The version macro appends the UTC commit date to the output of git
describe, which puts the dirty marker before the date. Move the marker
to the end of the shared compile-time version string.

A dirty build now reports 2.7.1-fbf0776c-20261117~ instead of
2.7.1-fbf0776c~-20261117. Preserve the clean version format and the
package-version fallback when Git metadata is unavailable.

Fixes #2908
2026-11-28 12:08:42 +08:00
fanyang 36ba7fb01e fix(cli): recognize all ACL JSON forms in acl set (#2890) nightly 2026-11-26 23:58:35 +08:00
fanyang 976cc4823e fix(connectivity): suggest disabling interface binding on connect timeout (#2875) 2026-11-26 23:58:05 +08:00
fanyang af67815c54 fix(cli): reuse mapped listener URL validation (#2886) 2026-11-26 23:56:34 +08:00
fanyang ee6d1b5d14 fix(cli): report invalid port-forward destination addresses (#2881) 2026-11-26 23:55:48 +08:00
fanyang 6711b06d08 fix(cli): preserve the TOML example in acl set help (#2889) 2026-11-26 23:55:08 +08:00
韩嘉乐 96329a1e11 refactor(ohos): flatten easytier-ohrs crate, add OHOS socket protection and lightweight local DNS (#2903)
- Merge internal easytier-ohos-core and easytier-ohos-features crates back into a single flat easytier-ohrs crate, removing unused workspace entries and rusqlite, and updating .github/workflows/ohos.yml.
- Add HarmonyOS NDK OH_NetConn_BindSocket socket protection with physical default network tracking for NativeSocketProtector.
- Add a lightweight hickory-proto + compile_dns() local authoritative DNS responder for both loopback delegation and packet-plane (100.100.100.101) resolution.
- Replace legacy Unix-socket polling and in-Rust SQLite storage with an event-driven GlobalCtxEvent watcher, compile-time protobuf schema generation, and jemalloc/log memory trimming.
2026-11-26 23:47:09 +08:00
fanyang 3ecc1b2895 fix(install): reject unknown commands before cleanup (#2891) 2026-11-26 23:45:59 +08:00
fanyang 82ab8afd27 fix(cli): preserve IPv6 brackets in RPC portal URLs (#2882) 2026-11-26 23:34:16 +08:00
fanyang 4bf3c9e93f fix(connectivity): back off reconnects to offline manual peers (#2877)
Addresses the retry frequency and log noise reported in #252.

First failure for a peer: warn once and schedule a retry.
Consecutive failures: double that peer's delay, up to 60 seconds.
Connection restored: clear the delay so the next disconnect gets a prompt retry.
Per-attempt CLI diagnostics remain available at debug level. Connection events are still delivered to subscribers.
2026-11-26 23:31:51 +08:00
fanyang b82e5946b6 fix(cli): reject conflicting instance selectors (#2887) 2026-11-26 23:25:18 +08:00
fanyang 4356968f0a fix(cli): honor --peers when listing connectors (#2885) 2026-11-26 23:24:51 +08:00
fanyang 28ab1a9c03 fix(cli): report STUN probe timeout instead of panicking (#2884) 2026-11-26 23:23:39 +08:00
KKRainbow c22a83b9d2 fix(peers): share TCP send queue capacity per network (#2868)
* fix(peers): share send queue slots within each network

Keep 32 ordinary FIFO slots per connection. When those fill, borrow
one of 480 shared slots from the network for each queued item.
Drop packets without blocking when no slot is available.

Increase the host packet delivery queue to 256 items to absorb
bursts at the receiving node.

* fix(peers): expire stale packets in peer send queues

Drop stale data packets as the peer writer drains its send queue.
Keep control packets eligible for delivery and preserve heartbeat
priority.

Set the age limit to twice the minimum heartbeat RTT observed over
the last five minutes, with a 50 ms floor. Apply lower limits
immediately and raise them gradually as the RTT baseline increases.
2026-11-26 23:21:09 +08:00
fanyang 85903a6a0f fix(routing): scope IPv4 directed broadcasts to the local subnet (#2871) 2026-11-26 23:20:42 +08:00
fanyang c3ee1440db fix(tun): restrict Linux route removal to the main table (#2869) 2026-11-26 23:16:02 +08:00
fanyang 7dac1b9d35 fix(tun): restore missing static IPv4 addresses on Linux (#2874)
Closes #2091. A Linux TUN can remain up after losing its static IPv4 address. Peers stay connected, but the host can no longer reach them through the tunnel.

Every 10 seconds while the static IPv4 is still configured:
  Read addresses in the TUN's network namespace.
  If the assigned address and prefix are missing, add them at the original ifindex.
  On error, log and back off to at most 60 seconds.
2026-11-26 23:14:53 +08:00
fanyang 7603df204f feat(cli): accept TOML names for encryption and routes (#2876) 2026-11-26 23:12:03 +08:00
fanyang c97f36b8d4 fix(web): allow explicitly trusted extra OIDC audiences (#2873) 2026-11-24 20:28:58 +08:00
fanyang 1415628969 fix(route): prevent avoid-relay cost overflow on 32-bit targets (#2870) 2026-11-24 20:28:24 +08:00
KKRainbow 45a6b6f176 fix(core): retain jemalloc mappings on 64-bit Linux (#2859)
A busy relay accumulated thousands of VMAs with retain disabled. A
run with retention enabled kept the VMA count below 60 for two hours.
Enable retention for 64-bit Linux jemalloc builds and let background
threads purge unused pages as the relay goes idle. Keep the existing
one-second dirty and muzzy decay in ordinary and profiling builds.
2026-11-20 22:41:11 +08:00
KKRainbow a08903362b fix(dns): isolate upstream queries and stop PTR loops (#2854)
Run DNS lookups in bounded, cancellable tasks so slow upstream queries
do not stall the TUN packet loop. Keep local DNS available when the
upstream limit is reached, and enqueue replies without blocking.

Answer unconfigured IPv4 PTR queries inside local TUN prefixes with
authoritative NODATA and an SOA. Preserve configured authorities and
forward other queries. Cancel pending lookups when the resolver closes.

Install Linux BPF before enabling packet reception, and synchronize
the listener recovery tests with accepted socket handling.

Fixes #2849.
2026-11-19 01:54:42 +08:00
dad0cf466d fix(direct): refuse UDP IPv6 direct connects that route through the overlay (#2855)
A public IPv6 client without native IPv6 has its only IPv6 default route
on the EasyTier TUN. The direct connector still dialed the provider's
native IPv6 UDP listener, so the underlay packets entered the TUN, were
forwarded to the provider over that same connection, and looped.

resolve_remote_addr already probes the local source address and rejects
targets that would use an EasyTier-managed IPv6, but connect_public_ipv6
resolved the literal URL directly and skipped it. Run the same check
there, before binding the socket or asking the peer to hole punch.


Claude-Session: https://claude.ai/code/session_018a4dgf9j7JT8Dd7HdqkKCX

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: KKRainbow <5665404+KKRainbow@users.noreply.github.com>
2026-11-19 00:33:09 +08:00
KKRainbow 5fd772b97a fix(connectivity): prioritize advertised interface IPv4 candidates (#2844)
Use the peer's advertised interface IPv4 list to identify preferred
candidates within each existing protocol group. Give all eligible
interface endpoints the existing 200 ms head start, including routed
addresses on different subnets and interfaces with public addresses.
Without an eligible interface candidate, dial the group concurrently.

Remove local interface-prefix collection and forwarding, along with
its dedicated mask and namespace tests. Keep explicit listeners bound
to their own endpoints and retain the shared numeric-host DNS bypass,
protocol ordering, IPv6 candidate rules, authentication and retries.
Do not probe after an ordinary connection exists or migrate traffic.

Adapt scheduling coverage for interface provenance, concurrent interface
attempts, public interface addresses, no eligible candidate, fallback,
blacklists, cancellation, slow DNS and ordinary-connection suppression.

Related-to: #2833
2026-11-18 23:33:27 +08:00
KKRainbow fbf0776cde fix(dns): handle empty NRPT policies and split Windows rules (#2841)
* fix(dns): handle non-redirecting Windows NRPT policies

Treat empty generic DNS server fields as non-redirecting policies while
checking active DirectAccess targets and retaining DNSSEC/IPsec
conflicts. Require an effective generic DNS target when confirming our
NRPT rule.

Add memory-only PowerShell regression cases for empty targets,
forwarding conflicts, security requirements, and ineffective rules.

Fixes #2840.

* fix(dns): split Windows NRPT namespaces into owned rules

Windows 10 LTSC can leave the suffix without DNS servers when a rule
contains both an exact namespace and its suffix. Use one rule for each
namespace and check effective policy after updating the complete pair.

Record both fixed IDs before writing either key, reuse them on updates,
and retain ownership until both obsolete keys have been removed. Keep
the existing recovery format so interrupted writes can be cleaned up.

Exercise target changes, a denied second write, retry, stable IDs and
search-list restoration in the existing Windows lifecycle test.

* fix(core): wait for instance cleanup before normal exit

Keep the instance runtime and interface alive until the existing stop
path finishes restoring DNS state, including startup errors and Windows
service stop requests. Preserve the original startup result after
cleanup.

Report StopPending and stop accepting controls inside the STOP handler
before notifying the asynchronous shutdown path. Publish the status
handle before reporting Running, and finish cleanup before Stopped.
2026-11-17 16:41:27 +08:00
KKRainbow 9cd05b9d5e fix(proxy): wait for TCP tasks during packet proxy shutdown (#2847) 2026-11-17 12:02:23 +08:00
KKRainbow ff442388d4 test(fec): use virtual time for memory recovery tests (#2848) 2026-11-17 12:01:40 +08:00
KKRainbow 0016779631 fix(websocket): preserve forwarded IPv6 addresses (#2843)
Write parsed proxy addresses with Url::set_ip_host. set_host treats an
unbracketed IPv6 address as a host string and truncates it at the first
colon, turning a leading numeric group such as 2409 into 0.0.9.105.

Preserve the accepted socket port and proxy query parameter. Extend the
existing forwarding test to cover IPv4, IPv6, loopback, Forwarded header
precedence and fallback, and matching resolved address metadata.
Allocate ephemeral ports so the cases can run in parallel.

Fixes #2838.
2026-11-16 22:31:44 +08:00
KKRainbow caa1ea4a75 fix(web): keep network member counts visible in navigation (#2842)
Let network labels shrink with an ellipsis so long unbroken names do not
push the member-count badge beyond the menu link's clipping boundary.
Keep the badge from shrinking or wrapping in desktop and mobile menus.

Validated the production frontend in Linux Chromium and macOS Chrome
with long and short names, Chinese and English, and counts up to
1234/1234. The responsive browser test, frontend build, rustfmt, and
strict Clippy pass.

Fixes #2839
2026-11-16 22:19:35 +08:00
ce72a49387 feat(web): allow entering a custom network secret (#2668)
The create dialog accepts an optional network secret; leaving it empty
keeps the server-generated one. The settings tab makes the secret
editable and only sends it when it changed, next to the existing
regenerate option. The server's existing validation still rejects an
empty secret.

Co-authored-by: 刚刚 <239500008+225284228a-droid@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 22:00:00 +08:00
175a1c79a3 feat(web): make the device enrollment command address configurable (#2742)
The console derived the config-server address in the enrollment command from the host the dashboard was opened with, which is wrong behind a reverse proxy, a port mapping or NAT.

Add --config-server-host (ET_CONFIG_SERVER_HOST) to easytier-web. It accepts a host, host:port or a full URL such as udp://et.example.com:22020, and is returned by /api/v1/console-info as config_server_host. The dashboard prefers it and falls back to the browser origin when it is unset, so existing deployments keep their behavior.

Both enrollment command displays (dashboard popover and empty device list) now share modules/enroll.ts instead of computing the host separately.

---------

Co-authored-by: 225284228a-droid <239500008+225284228a-droid@users.noreply.github.com>
Co-authored-by: KKRainbow <5665404+KKRainbow@users.noreply.github.com>
2026-11-16 21:45:31 +08:00
KKRainbow 0d9c52b169 chore: bump version to 2.7.1 (#2837)
Update the six product crate versions, workspace dependency requirements
and Cargo.lock without changing dependency resolutions.

Keep GUI metadata, the Magisk module version and release/Docker workflow
default tags in sync with the 2.7.1 prerelease.
v2.7.1
2026-11-16 02:06:43 +08:00
KKRainbow 969bf4948a feat(dns): add native per-domain desktop resolver integration (#2832)
* feat(dns): configure native per-domain system resolvers

Add native split DNS adapters for systemd-resolved, Windows NRPT and
macOS resolver files. Refuse automatic Linux integration when resolved
is not in the query path; retain the existing DNS server and root
forwarder.

Elect the shared server and install its packet handler and fake-IP route
before enabling system DNS. Serialize DNS record and OS updates, retain
empty authorities across partial failures, and refresh native settings
without restarting publishers.

Attempt to restore resolved link settings on explicit instance stop and
scope Windows/macOS cleanup to EasyTier markers. Keep finite D-Bus
waits, possible remote late writes and best-effort shared-link cleanup.
macOS writes requested regular files directly and does not restore
originals.

Exclude resolv.conf takeover, recovery/forwarder overrides and generic
process-exit handling. Preserve upstream same-zone publisher tests and
add private D-Bus and temporary-file lifecycle coverage.

Validation: DNS suite in the root rust container, run serially: 52
passed and one legacy-core test ignored. Strict full all-target clippy,
fmt and diff checks pass. Private D-Bus and file fixtures do not
establish real systemd-resolved or native Windows/macOS daemon
integration.

* fix(dns): disable resolved TLS on the Magic DNS link

A link inherits strict global DNS-over-TLS when no override is set, but
Magic DNS serves UDP/53. Snapshot the link effective mode with the other
owned settings and set it to no during setup and maintenance. Restore
the observed mode on close and track partial writes.

The D-Bus property exposes effective mode, so restoration does not
reconstruct whether the link originally inherited its value. Keep the
existing generation and timeout behavior, including possible late
writes.

Extend the private D-Bus fixture to cover mode restoration, partial
failure and networkd fallback. All 20 resolved tests pass; fmt and
strict workspace all-target clippy pass. Real resolved strict-DoT
queries remain unverified.

* fix(dns): preserve Windows DNS setup and cleanup retries

Allow missing IPv4 or IPv6 interface registry keys when checking and
updating search suffixes. Do not create missing protocol keys; retain
access errors and external-change checks on existing keys. Adapt the
existing lifecycle test to optional protocol keys.

Clear in-memory NRPT and search-list ownership immediately after durable
recovery cleanup succeeds, before attempting the DNS cache flush. Keep
flush errors visible without carrying stale ownership into a retry.
Leave state intact when recovery cleanup fails.

Windows GNU all-target cargo check passes. Linux strict workspace
all-target clippy and fmt pass; Windows-native registry and
flush-failure behavior was not executed.

* fix(dns): disable resolved DNSSEC for native Magic DNS

Private Magic DNS answers are unsigned. A link inheriting strict
systemd-resolved DNSSEC can reject the default et.net records even when
the fake-IP path returns the intended answers.

Include the sampled effective DNSSEC mode in the existing link state.
Set it to no before publishing DNS servers or domains and restore the
sampled mode after withdrawing them. Reuse partial-write tracking,
same-link maintenance, networkd delegation and owner-change handling.
The D-Bus property cannot distinguish an inherited mode from an explicit
one, so cleanup restores the sampled effective value.

Cover ordering, permission denial, partial cleanup, retries, maintenance
and owner changes with the existing private-bus fixtures. Give simulated
AccessDenied and UnknownMethod errors their exact D-Bus names rather
than the generic zbus wrapper name.

Validation:
- 23 resolved tests passed in the root rust container.
- Workspace fmt and strict all-target clippy with full features passed.
- Real isolated systemd-resolved 261.2 with global DNSSEC=yes resolved
  default et.net records and authenticated a separate signed control.
- Runtime updates and explicit stop cleaned the native link; a surviving
  link manager restored the sampled yes mode, with host DNS unchanged.

No NTA, resolver-file takeover or general process-exit changes.
2026-11-15 22:14:35 +08:00
KKRainbow d6b98c1b80 fix(peers): bound connection backpressure and batch local RPCs (#2831)
Large RPCs previously used one connection-queue slot per fragment.
Waiting for a slow destination could stall the shared dispatcher, while
queuing Pong behind ordinary traffic could also stall connection reads.

Keep each locally generated RPC's fragments in one ZCPacket batch until
the actual connection writer expands it. Preserve the existing packet
headers, individual wire frames, and per-fragment filters. Secure relay
still establishes and selects the final peer session in RelayPeerMap;
allocate encryption sequence numbers and encrypt each fragment in the
writer's PeerSessionTunnelFilter. Do not re-encrypt forwarded
ciphertext. Keep the existing 32-fragment pending-handshake limit.

Use a separate bounded Ping/Pong queue and check it between fragments.
Flush at most eight frames per round on the non-FEC path under the
existing seven-second timeout. Preserve FEC filter order and its per-
frame timeout.

Use try_send at ordinary PeerConn egress for every transport. A full
queue drops the current item, potentially an entire RPC batch, and
returns BufferFull without closing a healthy connection. Preserve typed
congestion errors through IP sending so the VPN Portal drops only the
rejected packet and keeps its client session alive. Fatal send errors
retain connection and Portal teardown. Leave generic MPSC senders and
internal RPC channels unchanged.

After a successful enqueue fills the ordinary queue, yield once to give
the writer a scheduling opportunity. This is a scheduling hint: Tokio
does not guarantee that the writer runs or drains before the producer
resumes. An already-full queue is still rejected immediately. There is
no capacity wait, retry, alternate-route selection, or queue
enlargement.

Queue limits count entries rather than bytes. Downstream drops may cause
RPC timeouts or incomplete forwarded RPCs, and IP traffic may be lost.
This does not provide complete isolation across shared paths, preempt
bytes already handed to TCP, or guarantee delivery on a slow link.
Multi-hop reassembly and application-level OSPF batching remain out of
scope. The individual wire encoding is unchanged; old-release binary
interoperability and an actual QUIC socket test were not run.

Validation:

- All six head CI workflows passed: 20 successful checks, four
  conditional skips, and 2060 tests passed with five skipped.
- Both original gateway failures passed 30 serial repetitions each at
  26c2e45f, with unchanged inputs, assertions, and timeouts: 60/60
  total. These observations do not establish a scheduling or no-loss
  guarantee.
- Reused targeted and regression results for 207-fragment delivery,
  direct and secure relay encryption, foreign forwarding, FEC, heartbeat
  scheduling, writer/session cleanup, queue admission, and Portal
  congestion and fatal-error lifecycles.
- Workspace fmt and strict all-target Clippy with full features passed.
  Final independent reviews found no remaining high-confidence defects.
- An earlier bounded 50 Mbit/s comparison showed similar throughput but
  more TCP retransmissions after try_send. The later yield change was
  not benchmarked; no saturation or throughput guarantee is claimed.
2026-11-15 01:30:49 +08:00
Zhengqi ZhangandKKRainbow 0009db4c22 refactor(android): extract core management and secure storage (#2593)
Extract application configuration and network management from the GUI
into easytier-core. Share ApplicationClient between GUI commands and
web-client hooks through ManagementHost, while the host retains RPC
transport and runtime ownership.

Persist Android configurations, desired-enabled IDs, backend options and
selection in a versioned native snapshot. Encrypt it with Android
Keystore AES-256-GCM, replace it atomically and verify commits. Reload
uncertain storage before another mutation.

Migrate localStorage only when native state is absent. Remove legacy
plaintext only after durable persistence succeeds, and reject unreadable
or invalid native data instead of overwriting it with defaults.

Separate confirmed runtime effects from persistence and reconciliation
warnings. Retain pending intent across RPC reconnects, query actual
state after RPC errors and complete stops despite save failures. Finish
Android VPN setup after nonfatal preference write failures; keep
bootstrap and required configuration failures fatal.

Preserve shared Android TUN behavior and serialize native status
sampling against start/stop events. Desktop keeps event/localStorage
persistence. Service-owned lifecycle, headless tile startup and
automatic intent recovery remain follow-up work.

Cover migration, uncertain commits, reconnects and VPN reconciliation
with regression tests. Android physical-device upgrade, restart and
storage-failure validation remains outstanding.

Co-authored-by: KKRainbow <5665404+KKRainbow@users.noreply.github.com>
2026-11-13 11:45:47 +08:00
thisxxx 3b32aaffc0 fix(security): stop disclosing the local network name to foreign peers (#2818) 2026-11-12 23:11:16 +08:00
KKRainbow 8877d9a6e8 feat(dns): merge compatible records from local publishers (#2824) 2026-11-12 22:27:48 +08:00
Aleksey Fedorov 232c94dbd6 fix(tun): only remove routes EasyTier added on Linux (#2820)
remove_ipv4_route and remove_ipv6_route deleted the first route that
matched destination, prefix length and interface. When a peer advertises
a proxy CIDR equal to the local virtual subnet, the kernel connected
route for that subnet matches too and is listed first, so withdrawing the
proxy CIDR deleted the kernel route and left EasyTier's own route behind.

EasyTier always adds routes with RTPROT_STATIC, so also match on the
protocol when looking up the route to delete.
2026-11-12 11:06:00 +08:00
KKRainbow 4f36fc1ffc feat(dns): publish live config and aggregate distinct zones (#2819)
Publish complete DNS configuration and node routes from each local
instance, and combine contributions from distinct static zones. Reject
conflicts while retaining accepted contributions until replacement or
connection withdrawal.

Accept requests from released clients that omit instance_id by owning
their records through the local publishing connection. Delay DNS RPC
registration until the internally managed route, zones, and packet
resolver are ready.

Validation: contribution and protocol lifecycle tests, released v2.6.4
client interoperability, root/TUN regression tests, fmt, strict Clippy,
and the required CI checks passed on the reviewed head. Native
Windows/macOS route-failure injection was not performed.

Retain the disclosed deferred minors and the pre-existing shared-TUN
external-route readiness boundary; these are not claimed fixed.
2026-11-12 10:26:21 +08:00
KKRainbow 2abb1676b4 feat(config): save DNS patches through Web and CLI (#2817)
Add validated DNS patches to ConfigRpc and CLI with saved-config
readback. Preserve omitted fields and replace or clear supplied zones.

Use heartbeat capabilities for Web patch planning and convergence.
Preserve desired DNS and other observed settings with older cores.

DNS patches only save configuration; applying DNS answers requires a
restart. Cover patch semantics, persistence failures, legacy readback,
and capability transitions.
2026-11-11 09:50:56 +08:00
KKRainbow 55c0303504 fix(dns): use presentation values for TXT records (#2816) 2026-11-11 08:15:50 +08:00
KKRainbow fa50fe62bc feat(fec): add bounded sliding-window UDP recovery (#2684)
Add optional connection-local recovery for native UDP peer traffic. Send
sources immediately and emit fixed-rate GF(256) repair frames over a
bounded sliding window. Negotiate bilateral activation and retain the
existing control-traffic reservations and connection filtering paths.

Expose FEC configuration, per-connection snapshots and nine network-
level packet, byte and recovery counters through existing management
APIs. Document frame accounting, MTU expansion, lifecycle and recovery
limits. Include generated management bindings and focused codec,
transport, negotiation and statistics coverage.

Ensure pull-request CI executes applicable checks instead of reusing
successful draft aggregates whose substantive jobs were skipped.

Validate the final head on the current main merge tree: all seven CI
workflows pass, including 2004 nextest tests. Reuse the existing stats
counter implementation and its explicitly accepted concurrency limits.

Retain the recorded low-loss performance acceptance failure as an
accepted first-version limitation; this CI result is not performance
acceptance. The existing FEC authentication/window review remains open
and is explicitly deferred for a later unified repair.
2026-11-10 23:42:03 +08:00
Aniki Nicole c74f782019 fix(linux): keep the GUI tray in the desktop user session (#2790) 2026-11-10 22:26:30 +08:00
KKRainbow f07d8d198a feat(dns): use structured static record configuration (#2812)
* feat(dns): structure static record configuration and validation

Replace zone-file record strings with name/type/TTL objects and an RDATA
value or literal TXT segments. Keep the existing 20 supported RR types
without adding per-type protocol messages or compatibility formats.

Compile file and management input through one core parser before
accepting a configuration. Validate names, type/data branches, TTL
inheritance, RRset conflicts and complete RDATA consumption with field
paths. Preserve editable input while sorting compiled RRsets by
canonical data. Complete relative SVCB/HTTPS targets against the zone
origin.

Adapt native DNS consumption, generated protocol bindings and frontend
configuration types to the same model. Automatic node records and DNS
publication behavior retain their existing runtime boundaries.

Validate with 98 core configuration tests, 10 native DNS unit/lifecycle
tests, frontend type/build/roundtrip checks and the existing 55 UI
tests. Browser/WASI core checks, workspace fmt and full Clippy pass.
Root/TUN integration is not run because the existing container cannot
load the host-built binary due to its older glibc.

* fix(dns): reject malformed SVCB input before library parsing

Hickory 0.25.2 assumes ALPN list decoding cannot fail. Empty members or
malformed character data instead trigger its expect, now reachable from
shared file and management configuration validation without enabling
Magic DNS.

Validate HTTPS/SVCB ALPN members after the same list unescaping before
calling the library. Reject a lone double-quote parameter value before
the adjacent library quote slicing can panic. Keep valid input tokens
and escaped ALPN data unchanged without catching panics or upgrading the
dependency.

Add one concentrated product regression through TOML and management JSON
configuration generation for invalid lists, escaped token errors, lone
quotes and valid ALPN lists/escapes. Preserve the structured schema, TXT
behavior and DNS runtime boundaries.

Reproduce the dependency panics first, then pass the targeted regression
and all 99 affected configuration tests. Workspace fmt and full Clippy
with -D warnings pass. Reuse prior unaffected frontend, codegen, native
lifecycle and platform checks.

* fix(dns): reject unclosed quoted service parameters

Require every quoted SVCB/HTTPS parameter to have an unescaped closing
quote before the library parser runs. Apply the check to opaque keys as
well as ALPN, preserving valid quoted values and literal backslashes.
Malformed file and management input now returns its existing value path.

Extend the concentrated product regression with unclosed opaque values,
escaped closing quotes and valid quoted parameters. Compare supported
CNAME escapes with the direct library parser and retain field errors for
semicolon and parenthesis labels that Hickory itself rejects. Keep name
tokenization and the structured configuration schema unchanged.

Reproduce the accepted malformed value through management generation,
then pass all 99 configuration tests, workspace fmt and full workspace
Clippy with -D warnings. Reuse unaffected native, frontend and platform
evidence; follow the published candidate's actual CI separately.
2026-11-08 21:39:48 +08:00
KKRainbow 921181dc38 fix(dns): return local CNAME address chains in answers (#2807)
Static CNAME records use Hickory's in-memory lookup results, which put
target addresses in ADDITIONAL. Stub resolvers therefore fail to resolve
valid aliases, and target lookups stop at the current zone.

Wrap local authorities for A/AAAA lookups and follow CNAME targets
through the most specific local zone. Return the full chain and final
address RRset in ANSWER while keeping owners and TTLs. Share raw local
authorities with the catalog under its write lock so lookups do not
reenter that lock. Other query types and unresolved chains retain their
existing behavior; no public recursion is added.

Extend the static-record lifecycle regression for address RRsets,
chains, zone selection, refreshes, explicit CNAME queries and cycles.

Validation: 19 DNS tests pass in the rust container; strict package
Clippy and workspace fmt pass. Existing glibc and Go clients resolve
same-zone and cross-zone aliases through the actual EasyTier listener.
2026-11-08 16:14:22 +08:00
Luna Yao 105f44d322 feat(dns): support local static records (#2708)
* feat(dns): support local static records

* fix(dns): normalize zone names with LowerName, preload static zones, and deprecate tld_dns_zone

- Normalize DNS zone names to LowerName across the server catalog and RPC boundaries to prevent uppercase/non-canonical zone suffixes from clearing node records.
- Preload all configured static zones during server initialization before registering the resolver and applying system DNS configuration.
- Deprecate tld_dns_zone in favor of [dns] domain, keeping tld_dns_zone as a hidden fallback without exposing it in help or schema defaults.
- Keep MagicDnsRecordStore using LowerName and restrict dns_route_identity to node hostname and IP.
2026-11-08 06:58:24 +08:00
KKRainbow ebca444374 fix(mini): enable IPv4 subnet proxying (#2806)
Compact host policy disabled the packet proxy even though mini already
selects the smoltcp proxy stack. Configuration normalization
consequently removed local proxy networks and skipped proxy startup, so
peers never learned configured subnets.

Declare compact proxy support from the smoltcp feature and enable mini's
existing native ICMP adapter. Reuse the current prefix announcements,
TCP/UDP services and lifecycle without adding dependencies or changing
routing protocols. Document IPv4 subnet proxy support.

Validate prefix installation and TCP/UDP/ICMP round trips in isolated
network namespaces with both smoltcp and the default TUN proxy path.
Check remote subnet access and withdraw the local subnet on restart to
verify the unconfigured behavior. Formatting and full-feature Clippy for
the affected packages pass; mini-only strict Clippy remains blocked by
an existing unused variable outside this change.
2026-11-08 00:59:48 +08:00
MiaM1ku 690b6be477 perf(easytier-go): keep guest memory off the Go heap and share the compiled core (#2782)
* perf(easytier-go): keep guest linear memory off the Go heap

wazero backs linear memory with a Go []byte and grows it with append, so
each memory.grow copies the whole guest heap into a new slice and leaves
the old one for the GC. The guest heap is also the largest live object
in the process, so GOGC lets the Go heap grow to about twice its size.
With 200 open overlay connections it was 76 MB of a 100 MB live heap.

On 64-bit unix and Windows, reserve the linear memory as one
inaccessible mapping and commit pages as the guest grows. The buffer
keeps a fixed address, stays outside GC accounting, and costs RSS only
for the pages the guest touches. A failed reservation falls back to a
heap buffer; 32-bit and other platforms keep wazero's allocator.

* perf(easytier-go): share the compiled core between hosts

Each Host compiled the embedded core in its own wazero runtime: about
2.4 s of CPU, a transient peak of ~170 MB, and ~30 MB of machine code
mapped for as long as the Host lived. Embedders that run one Host per
instance, or recreate a Host to recover from a failure, paid this every
time.

Give every runtime the same in-memory compilation cache and keep the
first compiled core open, so later Hosts reuse it after the first Host
closes. Compilation runs under a lock: concurrent Hosts wait for one
compile and then hit the cache.
2026-11-08 00:29:50 +08:00
Anya LinandKKRainbow 5b5558103a fix(core): conditional check for delegated routes (#2804)
* fix(core): conditional check for delegated routes

Instead of checking whether `candidate.dst` is equal to `prefix`, the logic is changed to check whether `candidate.dst` is contained within `prefix`.

* fix(core): ignore host routes when detecting delegated IPv6 subnets

A /128 lease route inside a WAN source prefix is not evidence of a
delegated subnet. Accepting it made provider reconciliation disable the
WAN NDP proxy after a client received its address.

Keep exact prefix matches and accept contained routes only when they
describe a subnet. This retains /60-to-/64 delegation detection without
using lease routes from any EasyTier instance as delegation evidence.

Cover exact matches, LAN subprefixes and multiple host routes. Exercise
NDP reconciliation with kernel routes, TUN recreation and a second
interface's lease route.

---------

Co-authored-by: KKRainbow <5665404+KKRainbow@users.noreply.github.com>
2026-11-08 00:18:49 +08:00