Commit Graph
100 Commits
  • docs(media): refresh panel screenshots for v3.8.5
    The README screenshots still showed the v3.2.5 layout. Retake every panel
    page in light and dark on the current UI, and redo the annotated Telegram
    bot setup shot for the new sidebar layout, marking the enable toggle too.
  • fix(clients): zero traffic before re-enabling a client on reset
    Invariant: a traffic reset leaves a quota-disabled client enabled
    everywhere. ResetTrafficByEmail and BulkResetTraffic enabled the client
    first and zeroed its counters afterwards. A traffic tick landing between
    the two still saw the client depleted and switched it off again in
    client_traffics, the record and settings. Update's direct record write
    then set the record back to enabled and the reset zeroed the counters,
    leaving the settings entry disabled: the client showed enabled with zero
    usage but was dropped from the runtime. The periodic reset job goes through
    ResetTrafficByEmail for every depleted client on its cycle, and a node push
    inside Update widens the window to seconds.
    
    Zero first, then enable: with the counters at zero the depletion predicate
    no longer matches, so the tick has nothing to undo. UpdateInboundClient
    re-adds the enabled user to the runtime itself.
  • fix(clients): stop client ops from reverting a renewal committed mid-op
    Invariant: an operation on an inbound's clients writes back only what it
    changed, onto the settings as committed when it writes. Every client op
    (add, edit, delete, bulk adjust/detach/delete/set-enable) read the inbound
    outside the serial traffic writer and then tx.Save'd the whole row inside
    it. A traffic tick that committed in between - auto-renew re-enabling a
    client, the delayed-start conversion, a node adoption - was overwritten
    with the stale copy. A renewed neighbour ended up enable=false with its old
    expiry in settings while client_traffics said enabled, so the next runtime
    rebuild dropped a healthy client nobody had touched. The bulk ops then ran
    a full SyncInbound from those stale settings, copying enable=false into the
    client record too.
    
    Each site now commits through commitInboundClientSettings: inside the
    serialized tx it three-way merges the op's edit (read -> output, per client
    and per field) onto the committed settings and updates only the settings
    column, which also stops the stale up/down/enable inbound columns being
    written back. advancePushedInbound now records what the per-client push
    delivered rather than the merged settings, so the node's reconcile-skip
    fingerprint cannot claim a renewal it never received.
  • fix(inbounds): accept v2.x client fields on inbound import
    Panels up to v2.x stored a client's tgId as a string, "" when unset. The
    startup migration heals copies already in the database, but an exported
    inbound imported into a current panel goes straight to AddInbound, whose
    typed client parse failed with "cannot unmarshal string into Go struct
    field .0.tgId of type int64", so every such import was refused.
    
    AddInbound now runs the legacy normalizer the clients-table seeder already
    used (moved from database to model so both share it) over the incoming
    settings before parsing them. String numbers become integers and empty ones
    are dropped, and the settings are stored in that shape. The same applies to
    /inbounds/add callers still sending the old types.
    
    The seeder change is a pure move; the PostgreSQL lane was not run (no
    Docker on this host) and is left to CI.
    
    Closes #6663
  • fix(x-ui.sh): read the service state without scanning the journal
    check_status ran `systemctl status x-ui` and grepped its Active line. That
    command also prints the unit's latest journal lines, so it reads the journal
    every time the menu is drawn, before most actions, and on hosts with months
    of logs the script stalled for a long time before showing its options.
    
    `systemctl show --property=SubState` returns the same "running" state from
    the unit alone. The prefix is stripped by hand rather than with --value so it
    still works on systemd older than 230.
    
    No test harness covers x-ui.sh. To demonstrate on a host with a large journal:
      time systemctl status x-ui >/dev/null
      time systemctl show --property=SubState x-ui
    
    Refs #6629
  • fix(wireguard): reject allowedIPs that overlap another client's range
    xray's WireGuard inbound credits a packet to the first peer whose allowedIPs
    contain its source address, and routes replies by the same table. The panel
    only rejected an allowedIPs entry that was string-equal to another client's,
    so a pre-assigned address typed in interface notation (10.10.2.9/24, as other
    WireGuard tools export it) was accepted and claimed the whole /24: other
    clients' traffic and online IPs were credited to that one email, and replies
    went to a peer with no endpoint ("no known endpoint for peer").
    
    The collision check now compares masked ranges on every path that uses it:
    add, edit, the cross-inbound recheck inside the write transaction, and
    AmneziaWG. Auto-allocation skips any address inside a prefix another client
    holds. A /0 default route still claims nothing, as before, because legacy
    migrated peers carry one. Clients already saved with overlapping ranges keep
    working as they do today until edited. The API docs describing the error are
    updated, including the stale claim that cross-inbound duplicates are accepted.
    
    Closes #6623
  • fix(tgbot): build a client's individual links in-process
    The bot's "individual links" and QR actions fetched the client's own
    subscription over HTTP from the public URL it builds for display. With no
    sub or web domain set that URL falls back to the machine's hostname, which
    usually does not resolve (`lookup exhausted-reply: no such host`), and even
    a resolvable name fails behind NAT, a firewall or a disabled sub server.
    
    Both actions now ask InboundService.GetSubLinks, the in-process provider the
    panel's links API already uses, with the host taken from that same URL so the
    link addresses are unchanged. The now-unused pooled HTTP client goes too.
    
    Closes #6597
  • fix(i18n): scope the empty Min Client Ver hint to cores that honour it
    The REALITY Min Client Ver hint promised that an empty field accepts every
    client version. That is only true on Xray-core v26.9.8+, but the panel's
    core switcher still installs v26.7.11 to v26.9.7, where an empty field falls
    back to a built-in 26.3.27 minimum and silently diverts older and
    third-party clients (Mihomo, sing-box) to the REALITY target. Operators on
    those cores were told the field was not the cause.
    
    The hint now names the version boundary in all 13 locales, matching the
    docs site. Text-only: no test can reach it; the change is visible in the
    inbound form's REALITY tooltip after `npm run build`.
    
    Closes #6568
  • feat(panel): let a sponsor slot start at a scheduled time
    sponsors.json only had an end date, so a booked placement had to be
    added to the file on the day it started. An optional `from` now hides
    a sponsor (and its logo) until that instant; entries without it show
    immediately as before.
  • fix(amneziawg): let the wrapped bind build peer endpoints
    resolvingBind.ParseEndpoint resolved a hostname and then built a
    StdNetEndpoint itself. That matches StdNetBind, the default bind on
    Linux, but on Windows the default is WinRingBind, whose Send refuses any
    endpoint it did not parse ("endpoint type does not correspond with bind
    type"). Every handshake initiation failed there, so no AmneziaWG tunnel,
    inbound or outbound, could come up on the Windows builds. ParseEndpoint
    now hands the resolved literal to the wrapped bind's own parser, which
    returns the endpoint type that bind sends to; StdNetBind and pinnedBind
    build the same StdNetEndpoint as before.
    
    The resolvingBind tests now read endpoints through the Endpoint
    interface instead of asserting StdNetEndpoint, which had pinned the bug.
  • fix(amneziawg): fall back to a free egress port when 64900 is refused
    The panel's SOCKS5 egress for AmneziaWG outbounds bound the fixed
    127.0.0.1:64900, and every generated socks bridge dialed that constant.
    64900 sits inside Windows' dynamic port range, where the OS can reserve
    whole blocks (this host excludes 64885-64984), so on the Windows builds
    release.yml ships the listener could stay down and every AmneziaWG
    outbound with it. Listen now tries 64900 first and falls back to any
    free loopback port; bridges, the outbound probe and the port-conflict
    check use EgressPort(), the port actually held. Bridges are generated
    apart from the listener, so BuildSocksBridge records the port it wrote
    and the AmneziaWG job requests an Xray restart while the listener holds
    a different one. Where 64900 is free nothing changes.
    
    The job's restart request is two lines of wiring no test reaches; the
    staleness it acts on is pinned by
    TestBridgesStaleUntilRegeneratedForTheBoundPort.
  • style(settings): fold the Happ settings into four tabs
    Seven tabs, several holding one or two settings, made the page hard to
    scan. The encrypted-links switch moves above the tabs under
    auto-detection, the colour profile joins the banners under Appearance &
    Theme, and Android per-app proxy joins Network & TUN Engine. The QR
    modal's settings link no longer needs a happTab selector, and the three
    orphaned tab-label keys are dropped from every locale.
  • style(clients): put Traffic Reset and Auto renewal on one row
    The renewal block took a full-width column, pushing Traffic Reset onto
    its own line. Each now gets a half-width column like the other fields,
    with its follow-up inputs stacked under it.
  • fix(nodetoken): stop refusing every node-token key file on Windows
    FileKeySource rejected any key file whose mode had group or other bits,
    but Windows has no such bits: Stat reports every writable file as 0666.
    On the Windows builds release.yml ships, the key file therefore never
    loaded, not even one written 0600, and only XUI_NODE_TOKEN_KEY could
    supply a key. The mode check now applies off Windows only, the stance
    the DB permission tests already take; there the file's NTFS ACL guards
    it, and env-vars.mdx says so in all four locales.
    
    The load test is split so the half that must hold everywhere, an
    owner-only file loading, also runs on Windows, and the rejection half
    asserts the exact error instead of any error.
  • fix(panel): skip the proxy env forwarding test on Windows
    Windows env var names are case-insensitive, so https_proxy and
    HTTPS_PROXY resolve to the same variable there and updateProxyEnvVars
    forwards it under both names. The helper only runs on Linux - startUpdate
    refuses every other platform - so the test's case-sensitive expectations
    only hold, and only matter, on Linux.
  • fix(logger): reuse the open log rotator when InitLogger runs again
    Every InitLogger call built a new lumberjack rotator and dropped the old
    one without closing it, leaking a handle on 3xui.log per call, and
    loggers still writing through an old rotator kept it alive. On Windows
    the open handles block deleting the file, so
    TestInitLoggerConcurrentWithLogging failed its t.TempDir cleanup there.
    InitLogger now reuses the open rotator for the same path and closes it
    only when the path changes, and the test closes the logger it opened.
    Neither half is enough alone: with only one of them the test stays red
    on Windows.
  • fix(database): close the pool a second InitDB replaces
    InitDB assigned the new pool over the old one without closing it. The
    panel's own restore flows call CloseDB first, but any other re-init
    leaked the replaced pool and its handle on the database file. On Windows
    that handle blocks deleting the file, which is why the four GetApiToken
    CLI tests failed their t.TempDir cleanup there: dbtest.InitDB opened the
    store, then GetApiToken's own InitDB replaced it. InitDB now closes the
    previous pool itself; sql.DB.Close is idempotent, so the restore flows
    behave as before.
  • chore(git): check out every text file with LF, not only Go and scripts
    .gitattributes forced LF only for Go, shell, generated files, snapshots
    and deploy YAML, so a Windows clone with core.autocrlf=true got CRLF
    everywhere else. On that working copy `make format-check` flags 198
    frontend files, `msw-worker-check` sees mockServiceWorker.js differ from
    the installed copy, and TestAnalystContextNamesRealCIJobs and
    TestReviewNamesRealCIJobsAndGates find no ci.yml job at all, while Linux
    CI stays green. `* text=auto eol=lf` extends 5c5a5096 to every text
    file. No committed blob changes: the index already holds LF everywhere,
    and binary detection still leaves the 50 binary files alone.
    
    An existing Windows clone applies it with a fresh checkout on a clean
    tree: `git rm -rq --cached . && git reset -q --hard HEAD`.
  • refactor(logger): choose the console backend with build tags
    The runtime.GOOS switch compiled the syslog branch into Windows builds,
    where go-logging's syslog stub always returns an error. staticcheck
    therefore reported SA4023 at logger.go:95 on every Windows lint run,
    keeping `make lint-go` red on a clean main there while Linux CI never
    saw it. console_windows.go and console_other.go now pick the backend at
    build time, with each platform's behaviour unchanged.
    
    No test can observe build-tag selection: `golangci-lint run` on Windows
    goes from 1 issue to 0, and `GOOS=linux golangci-lint run
    ./internal/logger/...` stays clean.
  • perf(tests): copy a migrated template DB instead of migrating per test
    Most tests opened a throwaway panel DB with database.InitDB, which runs the
    full AutoMigrate + seed on an empty file every time: ~230ms, and ~850ms under
    -race because GORM's reflection-heavy migration is what the detector slows
    most. internal/web/service does this in ~550 of its 830 tests, so the CI race
    job spent ~10 of its ~14.6 minutes re-migrating empty databases.
    
    internal/database/dbtest.InitDB migrates once per test process, then hands
    each test its own copy of that file (~130ms under -race) and registers the
    CloseDB cleanup. The copy then goes through InitDB like a panel restart, so
    every test still starts from the state a fresh install has. Tests that reopen
    an existing file, migrate a hand-built legacy DB or target Postgres keep
    calling database.InitDB.
    
    Locally under -race: internal/web/service 626s (last CI run) -> 114s,
    internal/sub 246s -> 35s.
  • chore(ci): stop release and CodeQL runs on PRs, drop deploy smoke tests
    The release matrix (7 Linux cross-builds + a CGO Windows build) ran on every
    PR and on every branch push, so a PR from a repo branch built everything
    twice. Release binaries now build only on main (dev channel) and version
    tags; any other branch can still be built via workflow_dispatch.
    
    CodeQL keeps its push-to-main and weekly scans but no longer runs per PR.
    
    The deploy smoke workflow fired on every Release completion only to skip
    its jobs; deploy/test/smoke-noninteractive.sh stays for manual runs.
  • chore(gen): regenerate types for addrFamily
    Regenerate frontend/src/generated/types.ts and zod.ts to include the new addrFamily enum type, produced by tools/openapigen from Go struct changes.
  • docs: adopt correct-fix-over-small-fix and TDD policy
    Replace the "smallest fix" rule with a "correct fix over small fix" policy: fix root causes properly, regardless of size, while still disallowing speculative additions. Add a dedicated TDD section (red-green-refactor, fake-test prohibitions) to CLAUDE.md and CONTRIBUTING.md, consolidating prior scattered testing guidance. Also promote jackc/pgx/v5 from an indirect to a direct go.mod dependency.
  • fix(panel): validate sponsor logo name before any file or network use
    The public /sponsors/logo/:name route only accepted names matching an
    active sponsor's logo, which was already regex-filtered, but that guard
    was indirect. Checking sponsorLogoRe on the name itself makes the
    path/URL safety local and clears CodeQL alerts #113 (go/request-forgery)
    and #114 (go/path-injection).
  • feat(panel): add sponsor slots fed from sponsors.sanaei.dev
    Monthly sponsor placements need to change without cutting a panel
    release. Panels now read 3X/sponsors.json from the MHSanaei/sponsors
    repo (GitHub Pages on sponsors.sanaei.dev) and show active sponsors in
    four slots: an overview banner, a rotating sidebar card (max three), the
    login page and a new Sponsors page that also lists open placements.
    
    An entry shows only while enable is not false and until is in the
    future; links must be https and logos are png/webp/jpg by name only.
    The list is cached for an hour and the last good copy survives upstream
    failures; logos are proxied through /sponsors/logo/:name with failures
    cached, so CSP stays 'self' and admin browsers never reach a third
    party. Admins can hide a slot for 24h. Under XUI_DEBUG the panel reads
    a sibling ../sponsors/3X checkout so edits can be previewed before push.
  • fix(frontend): key geo entries by page position and clear test-suite noise
    Zod 4: use the `error` param instead of the deprecated `message`.
    lint:deprecated missed these because tsgolint's no-deprecated does not
    resolve object-literal properties on a `string | Params` union.
    
    Geodata: key geo entry rows by page position. antd deprecates rowKey's
    index argument, and kind:value repeats within a page because the reader
    drops domain attributes (22 pairs in geosite_IR.dat, 108 in geosite_RU).
    
    Nord/PIA: the "All cities/regions" option used a null value, which antd
    warns on. Map it through a sentinel at the Select boundary so form state
    stays null, with tests that fail when the sentinel is not mapped back.
    
    Tests:
    - Run the oxlint guard through node; .bin/oxlint is a sh shim Windows
      cannot spawn, and the swallowed error left both guard cases vacuous.
    - Start unit workers with --no-experimental-webstorage; msw's localStorage
      probe made Node 25+ warn once per forked worker.
    - Set IS_REACT_ACT_ENVIRONMENT, which RTL never sets with globals: false,
      and settle the async updates it exposed inside act(). The row-cells
      memo test now fails when memo is removed.
    - Disable antd's click wave in Storybook; it re-rendered inside the next
      story's act() and tripped "not configured to support act".
    - Assert InboundFormModal's validation log instead of leaking it, and
      give the rule-form test a well-formed clients/list response.
  • ci: update Claude workflow model settings
    Use Claude Opus 5.5 with high effort for issue analysis and PR reviews.
  • chore(deps): update toolchains and dependencies
    Raise the frontend baseline to Node 26/npm 11 and refresh contributor documentation. Update frontend, documentation-site, and Go dependencies with regenerated lockfiles and module checksums.
  • feat(hosts): add a cipher suites override and accept custom suites
    The inbound TLS form offered cipherSuites as a closed single-choice list,
    but xray reads the value as a colon-separated list and accepts any name Go
    knows, so several suites or one missing from the list could not be set.
    Both the inbound and the new host field now use a tag picker that keeps
    the stored value as the colon-joined string xray expects; old single
    values open unchanged.
    
    A host's cipher suites replace the inbound's in the JSON subscription
    stream, and a blank field inherits them. Share links and Clash carry no
    cipher suite parameter, so their output is unchanged.
  • fix(clients): list HWID devices when the HWID limit is 0
    EnforceHwidForSubID returned before recording anything when a sub had no
    limit, so the panel's HWID Devices list stayed empty for every unlimited
    client. Devices are now upserted on the (sub_id, hwid_hash) index without
    enforcement or X-Hwid-* headers; the write is best-effort and only logs on
    failure, so tracking can never deny a subscription nothing restricts.
  • fix(nodes): chart node net throughput in KB/s, not percent
    The node history panel passed its Net Up / Net Down series to Sparkline
    without valueMax or yFormatter, so they inherited the percentage defaults:
    a fixed 0-100 scale and a "%" label. Any node above 100 KB/s drew off the
    top of the chart and every axis tick and tooltip read as a percentage.
    
    A Sparkline fed non-percentage data has to declare its own scale and unit;
    every other call site already did, only the two node net series did not.
  • fix(logger): fix data race in InitLogger
    Replace the package logger variable with an atomic.Pointer so InitLogger swapping the handle no longer races with concurrent Debug/Info/Warning/Error calls from other goroutines. Also guard fileRotate with a mutex, and add a regression test that reproduces the race under concurrent logging.
  • feat(sub): redesign the subscription page around usage, tabs and app imports
    The info page was a long key/value table followed by every link and two
    app dropdowns, and it rendered left-to-right even for Persian and Arabic.
    It now leads with a usage ring, the remaining quota and a stats grid, and
    splits the rest into Subscription / Apps / Configs tabs.
    
    - Status tells expired, data-used-up and disabled apart instead of one
      "Inactive", replacing the hard-coded English expiry chip.
    - The Apps tab keeps every Android and iOS app with its existing deep
      link, preselects the visitor's platform and adds Windows: Hiddify and
      Clash Verge Rev import directly, v2rayN copies the link.
    - fa-IR and ar-EG render right-to-left; URLs, IDs and sizes stay LTR.
    - The footer shows the support link and the client refresh interval, so
      subPageContext now carries subUpdates (also in ?format=info).
    - Status, days-left and app deep-link logic lives in subPageModel.ts,
      with unit tests pinning the deep links the page already shipped.
  • feat(api-docs): split the API docs page into tabs
    The page stacked the WebSocket event cards above every Panel API operation
    in one long scroll. The WebSocket events and the 3X-UI Panel API now sit in
    separate tabs, and the Panel API shows one OpenAPI tag at a time through
    section tabs placed between the Authorize bar and the operations.
    
    The section tabs replace Swagger UI's FilterContainer and wrap the
    taggedOperations selector, so all sections share one Swagger instance and
    keep authorization and try-it-out state. Swagger's own filter matches tags
    by substring ("Settings" would also show "Xray Settings") and does nothing
    until set, so the wrapper matches the exact tag and defaults to the first.
    Tag names come from the loaded spec rather than importing endpoints.ts,
    which would have grown the page chunk from 23 kB to 119 kB.
  • fix(outbounds): keep subscription tags on their server when reality params rotate
    A subscription outbound's tag must stay bound to the upstream server it
    was assigned to for as long as that server stays in the subscription;
    balancers and routing rules select by that tag.
    
    The identity used to recognise a server across refreshes included every
    query parameter. A 3x-ui upstream picks a random shortId and SNI of a
    reality inbound on every request (older releases a random spiderX too),
    so no reality link was ever recognised, the stable-tag reservation never
    engaged, and every tag was handed out by list position. Removing or
    inserting a server then re-pointed existing tags at other servers:
    sub-germany carried France, sub-sweden Germany, and Sweden became
    sub-sweden-1. The identity now ignores sid, sni and spx when
    security=reality, since none of them selects the server. TLS sni still
    counts: it can pick the backend behind a shared front.
    
    Two more paths broke the same rule:
    - A link repeated in one body (same identity, different remark) shared a
      single link_identities key, so both tags gained a -N suffix on every
      refresh. Repeats are now numbered.
    - Links the core rejects were dropped after tagging, so the stored list
      that drives positional reuse was shorter than the parsed one and a
      rotated server behind a dropped link took its neighbour's tag. The
      filter now runs first; a dropped link's warning names its remark
      instead of a tag it never used.
    
    A mapping an older build already swapped stays swapped: its stored
    identities no longer match, so positional reuse reproduces it. Deleting
    and re-adding the subscription reallocates the tags from the remarks.
    
    Closes #6556
  • feat(clients): filter the client list by clicking a summary stat card
    Each card on the Clients page now toggles its status bucket as the sole
    filter, and the Clients card clears it. The bucket filters used to be
    wider than the card counts: "active" still included clients near
    depletion and "deactive" included disabled clients that had run out, so
    a filtered list could disagree with the number on the card. Both filters
    now reuse the summary expressions, and a test pins each card's count to
    the size of its filtered list.
  • style(logs): widen the row-count selector in the log modals
    At 70px the selector truncated its larger values, so the chosen row
    count was hard to read in the panel, Xray and AmneziaWG log modals.
  • fix(clients): stop the Edit Client modal showing a stray light scrollbar
    The client form body is capped at the viewport and scrolls internally
    (49ef1449). Every tab ends with a Form.Item that keeps antd's 24px bottom
    margin, so when the fields themselves fit, that empty margin alone pushed
    the body past the cap: 752px of content in 740px at a 900px window. The
    last item of each tab now drops the margin, so the body scrolls only when
    real content overflows.
    
    When it does scroll, the bar was painted light inside the dark modal: the
    dark themes set body.dark and data-theme but never color-scheme, which is
    what native scrollbars read. applyDom (panel, login and subscription
    bundles) and the Storybook decorator now set it on the root element.
  • fix(nodes): stop flagging a node on the other update channel as outdated
    A node's "update available" tag compares its reported panel version with the
    master's latest, and any non-semver side fell back to string inequality. A
    dev build reports dev+<sha> (config.GetPanelVersion), so a node moved to the
    dev channel from a master on the stable channel kept the tag forever; the
    reverse, a stable node under a master on the dev channel, was flagged too and
    the tag's default stable update installed nothing new.
    
    A dev label and a release tag carry no order, so the comparison now only
    decides within one channel; dev-to-dev still compares commits, which keeps a
    node on the current dev-latest commit untagged as config.go intends.
  • perf(nodes): keep the node table element across unrelated re-renders
    rc-table re-runs every cell renderer whenever the Table re-renders, and
    NodeList rebuilt its columns and table props on every render (the relative
    time formatter was a fresh function each time). Any re-render of the Nodes
    page therefore re-rendered all rows even when no node had changed: about
    390ms per re-render for 150 nodes in jsdom.
    
    The formatter is now stable and the table element is memoized on its
    inputs, so a re-render that leaves the nodes untouched costs 0.5ms. A
    heartbeat push that does change the nodes still re-renders every row.
  • perf(inbounds): keep unchanged rows and online sets across websocket pushes
    Every client_stats push carries the totals of all inbounds, and
    applyClientStatsEvent rebuilt each row it listed, so every push replaced
    all rows, re-ran the client rollup (a JSON parse of every inbound's
    settings) and re-rendered the whole table even when no number moved. Every
    traffic push also built new online and active maps, re-running the same
    rollup.
    
    Rows are now rebuilt only when their totals or a client's numbers change,
    and the previous maps are kept when a push repeats the same sets. Measured
    in jsdom with 450 inbounds of 50 clients each: an unchanged client_stats
    push went from 7.9ms to 0.6ms with no row rebuilt, and a repeated traffic
    push from 13.5ms to 8.3ms without the rollup.
  • fix(ldap): apply LDAP enable, disable and cleanup through the bulk paths
    The LDAP sync enabled, disabled and detached clients one at a time. Each
    per-client call locked the inbound and pushed to its node under that lock
    with a 4s timeout, so users sharing an inbound on a node that answers its
    status probe but hangs on client writes queued one push timeout apiece:
    five users took 20s in the test, and hundreds of directory users behind a
    hung node stretched one run over hours. Each changed email was also queued
    once per configured tag, repeating a no-op lookup for every extra tag.
    
    Enable and disable now go through BulkSetEnable, and the cleanup through
    one BulkDetach per inbound: each inbound is locked, written and pushed
    once, and its push stops at the first failure for the reconcile to finish.
    The same five users now cost a single push timeout.
  • chore(node): cover the sync tick's online prune from the job package
    The traffic sync's call that drops online sets of nodes it no longer
    fetches had no test: a job-package test cannot install an xray process,
    so online state was invisible there and removing the call passed.
    
    SetXrayProcessForTest installs a test process for tests in other packages,
    the same kind of seam as Manager.SetRuntimeOverride. The new job test runs
    a real tick with a disabled node and a deleted one and fails without the
    call.
  • fix(node): release a deleted node's metric series and HTTP client
    Deleting a node must free what the master keeps per node in memory.
    
    Delete dropped the node's cpu and mem series but not netUp and netDown,
    which the heartbeat records too, so each deleted node leaked two tiered
    histories. It now drops every NodeMetricKeys entry.
    
    InvalidateNode, called on node edit, disable and delete, cleared only the
    cached Remote. The pooled HTTP client and its transport stayed cached until
    a later call for the same node pruned them, which a deleted node never
    makes. InvalidateNode now drops those too, outside the manager lock; an
    edited node pays one fresh handshake on its next call.
  • perf(node): sync up to 32 nodes at once, like the heartbeat
    The traffic sync is scheduled every 5s but synced only 8 nodes at a time,
    each needing four to seven sequential requests. Past about 125 nodes 80ms
    away a tick outlasted its interval, so dashboard traffic, online clients
    and quota enforcement moved at a fraction of the intended cadence.
    
    Measured with 150-300 fake nodes over real HTTP, 80ms latency, a dashboard
    connected and client-IP sync on:
    
      SQLite, 300 nodes        8: 25-30s   16: 14-16s   32: 6-9.5s
      SQLite, 150 (20% slow)   8: 24-27s   16: 13-14s   32: 6-7.5s
      Postgres, 150 nodes      8: 13-18s   16: 7.5-10s  32: 6.5-8.3s
    
    No database-locked, pool or writer-queue errors at any setting, and the
    merged inbound and client traffic counts matched. Postgres's one-off
    adoption tick is slower at 32 than at 16 (16.5s vs 9.7s) as goroutines
    wait on its 25-connection pool; steady ticks are fastest at 32.
  • fix(traffic): reset due inbounds and clients concurrently
    The periodic reset job reset every due inbound, then every due client, one
    at a time, and each waited on its node: up to 10s per node inbound, and 4s
    per attached node inbound for a client. A few hanging nodes stretched a
    single run over hours.
    
    Both loops now run eight at a time. With the per-client fan-out of four
    that stays within the 32 concurrent node calls the other node fan-outs use.
  • fix(node): send one alert for a burst of node transitions
    A master-side network blip flips every node in one heartbeat tick, and
    each node published its own node.down, then node.up. A notifier queue holds
    64 events and the rate limiter keys on the node name, so with 150 nodes most
    alerts were dropped and the rest ran into Telegram and Discord limits.
    
    Past five same-direction transitions in one tick the heartbeat publishes a
    single event per direction naming the nodes (the first ten, sorted, then
    +N). Smaller ticks keep per-node events with their health data, and the
    notifiers already read the node name from Source, so no formatter changed.
  • fix(node): fan out operations that call every node
    An operation that calls every node has to finish inside the panel's 30s
    write timeout. Reset all traffic, UpdatePanels and bulk inbound delete
    walked the nodes one at a time, up to 10s per hanging node, so 15 hanging
    nodes out of 150 kept each request running for 2m41s while the browser
    had already been told it failed.
    
    All three now fan out through fanoutInboundResults, bounded by
    nodeFanoutConcurrency (32, the heartbeat's bound), and UpdatePanels keeps
    its results in request order. Bulk delete still removes the rows one at a
    time, since each rewrites shared routing references, and only fans out the
    node pushes that delInbound now hands back.
  • fix(node): drop online clients and sub-nodes of nodes no longer synced
    What the master derives from a node's reports (online clients, active
    inbounds, learned sub-nodes) must live only while that node is still
    synced; ClearNodeOnlineClients states it: a downed node must not keep its
    clients listed as online.
    
    Only a failed snapshot fetch cleared the online set, and only a failed
    probe cleared sub-nodes. A disabled node (both jobs skip it), a node marked
    offline before the sync tick reached it, a deleted node, and a node whose
    snapshot fetched but failed to merge all kept their clients online in
    onlineClients, onlineByGuid and activeInbounds, which the dashboard and a
    parent master's /clients/onlines read. Disabled and deleted nodes also kept
    their sub-nodes on the Nodes page until the panel restarted.
    
    The traffic sync now keeps online sets only for enabled, online nodes in
    its list, the heartbeat keeps sub-nodes only for enabled listed nodes, both
    before the empty-list return, and a failed merge clears like a failed
    fetch. The sync job's one-line call has no job-level test: that package
    cannot install the xray process, so RetainSyncedNodeOnlineClients carries
    the tested rule.
  • fix(traffic): push depletion changes to nodes off the serial writer
    Node I/O on the traffic-accounting path must never stall accounting; the
    serial writer states it ("Keep network I/O (node pushes) OUT of fn").
    
    AddTraffic still applied the depletion UpdateInbound for every node
    inbound inside the writer closure, one at a time with context.Background.
    One hanging node held the single writer for each push, freezing traffic
    polls, node snapshot merges and every client edit for the whole wave; a
    client shared by 150 nodes expiring could hold it for tens of minutes.
    The opt-in restart on client disable then ran node by node on the same
    traffic job.
    
    Remote plans now leave the writer and go through nodePushPlan and the 4s
    nodePushContext, fanned out like client pushes: an offline or slow node
    defers to the reconcile its dirty flag already schedules. The node restart
    runs in its own goroutine, since nothing replays or waits on it.
    
    TestTrafficDisableImmediatelyUpdatesNodeRuntime called addTrafficLocked
    directly, which pinned the push inside the writer; it now calls AddTraffic
    and still requires the push to have landed on return.
  • fix(node): push a node only the client IPs it hosts
    A master's per-node sync must scope what it sends to the clients that node
    serves, so its cost tracks the node and not the fleet. The global-usage
    push already did (node_client_traffics by node_id); the 10s client-IP push
    sent GetAllInboundClientIps, the whole table, to every node.
    
    Each node's MergeInboundClientIps then created a row for every foreign
    email, and its next GET clientIps echoed the whole fleet back. Its IP-limit
    job only ever reads rows for its own clients, so none of it was used. With
    150 nodes x 150 clients, one IP tick pushed 299 MB and pulled 264 MB, every
    node held 22,500 rows instead of 150, and sync ticks grew 3.8s -> 10.2s
    even at 1ms latency; the cost grows with the square of the fleet.
    
    Both pushes now share nodeHostedEmails. After the change the same fleet
    moves 2.0 MB / 1.8 MB per tick and ticks stay near 3.2s. Nodes upgraded
    with foreign rows shed them within 30 minutes via pruneStaleIpRows.
  • chore(docs): bump dependencies and adapt to fumadocs-core 16.15.11
    Updates the docs site's dependencies, including the Fumadocs packages,
    Next 16.3.5, React 19.3 and three majors: mermaid 12, vitest 5 and
    pnpm 12. Two code changes follow from the bump:
    
    - fumadocs-core 16.15.11 makes `llms().index()` return a Promise, so
      the llms.txt route now awaits it; tsc rejected the old synchronous
      call
    - lucide-react 1.46 renamed the BookMarked icon to BookBookmark. The
      old name is still exported, but lucideIconsPlugin looks names up in
      lucide's `icons` map, which only has the new one, so the Reference
      section lost its sidebar icon in all four locales. The build only
      printed a warning.
    
    minimumReleaseAgeExclude gains entries for the newly installed
    versions.
    
    Checked with typecheck, lint, vitest (106 tests) and a full build: no
    plugin warnings, and each locale's rendered /docs page contains the
    book-bookmark icon.
  • fix(xray): stop a lone dns qType 0 from matching every query
    The core reads a dns rule's qType as a PortList, which drops a bare numeric
    0 (infra/conf/common.go: `if number != 0`), and a rule with no qTypes
    matches every query. A stored `"qType": 0` therefore does not target query
    type 0: it drops, refuses or hijacks all DNS through that outbound.
    
    A qType the panel writes has to be read by the core as exactly the query
    types it names. Four writers broke that:
    
    - DNSOutboundLegacyKeysFix rewrote a lone blockTypes [0] into "qType": 0,
      so "block type 0" became "block everything" on upgrade.
    - That seeder shipped in v3.8.0 and is recorded as done, so fixing it does
      not reach installs that already ran it. DNSOutboundQTypeZeroFix spells
      any stored numeric qType 0 as "0" once, protocol id matched like the core.
    - The outbound form adapter turned a typed "0" into the number 0.
    - The Xray template editor saves raw JSON past that adapter; the save now
      applies the same rewrite.
    
    Each writer is pinned by a test that fails without its part. The rewrite
    and the repair compare policies as the pinned core builds them, and the
    repair runs through runSeeders over a database whose legacy-keys seeder
    already ran, on SQLite and PostgreSQL 16.
  • chore(deps): update frontend and Go deps
    Update Ant Design, React i18n, Zod, testing utilities, Oxc tooling, GORM Postgres, Pion transport, and sing dependencies to their latest specified versions.
  • fix(amneziawg): bound the SOCKS5 UDP associate exchange
    newSocks5UDPSession only bounded the dial. The greeting, auth and UDP
    ASSOCIATE reads on the control connection had no deadline, and they run
    inline in UDPRelay.Handle -- on the peer's receive goroutine that delivers
    decrypted packets into gVisor. A SOCKS5 server the kernel accepts for but
    that never answers (a wedged Xray: its listen backlog still completes TCP
    handshakes) therefore parked that goroutine, and every later packet from
    the peer behind it, TCP included, for as long as Xray stayed wedged.
    
    One deadline now covers the dial plus the whole exchange and is cleared
    once the association is up, since after that the control connection is
    only held open. The test drives the exchange against a listener that is
    never accepted, which is exactly the hung-server shape.
    
    This was the last of the three defects confirmed on the issue: the header
    protection key that could not be cleared went with cfd596a4, the missing
    PersistentKeepalive with 8f162994, and the manager lock inversion the same
    thread flagged with e95fe80f. The session death the issue was opened for
    is not a panel defect. The reporter's own capture on the host NIC shows
    the client's packets stop reaching the VPS after the first burst, the
    server never sees a second handshake initiation from it, and nothing the
    panel sends is outside what a stock amneziawg-go 3.1 server sends (the
    Apple client embeds the same library build). That is a client- or
    path-side stop, which no server-side change can address.
    
    Closes #6323
  • fix(node): import a newly selected node inbound instead of sweeping it
    Saving the node form writes the grown selection and marks the node dirty
    in one transaction. On the next tick ReconcileNode runs before the
    snapshot merge, and its delete sweep treats a selected tag with no
    central row as "deleted on the master" — so an inbound the operator just
    ticked in the picker (or every unselected one, when switching the node
    to "all") is deleted from the node before the import that would have
    created its row ever runs.
    
    Nothing on disk separates "pending import" from "deleted while the node
    was unreachable", but the pre-adoption guard already expresses the
    former: while inbounds_adopted_at is zero the sweep waits for a clean
    sync to adopt. A save that grows the managed set now zeroes it again,
    and the same clean sync re-stamps it, so the offline-delete sweep is
    only deferred by one successful sync, not disabled.
    
    The trade: an inbound deleted on the master while the node was
    unreachable is re-imported instead of swept if the operator grows the
    node's selection during that same outage. That is visible and
    recoverable, where the previous behaviour destroyed a live inbound.
    
    Closes #6329
  • fix(tgbot): guard the mock Telegram server's call counts
    staleButtonServer increments its per-method map from the HTTP handler, which
    httptest runs on one goroutine per connection. #6491's
    TestAdminListReadersShareTheWriterLock is the first test to reach it from
    several goroutines at once, so CI's race job flagged the helper's map rather
    than the code under test.
  • fix(tgbot): answer only the link callbacks that match nothing
    #6493 was written against the if/else chain where every served link action
    returned early, so its trailing answer ran only for an unrouted payload. #6489
    had already turned that chain into a switch that falls through, so after the
    merge every served link tap also got an error toast, while an unknown payload
    still returned from the !ok branch unanswered.
    
    Move the answer into the !ok branch, the one place nothing matched. This
    turns TestClientLinkCallbackServesOwnClient and TestUnroutableCallbackIsAnswered
    green again on main's go-test job.
  • docs: update star history badges
    Replaced the legacy starchart.cc widget with Star History chart and badge embeds in the main README and all localized variants. This keeps the star visual consistent and adds ranked/trending badges for easier repository context.
  • Update deps and fix AntD Space API
    This change bumps the frontend and Go dependency set to newer patch/minor releases, including Vite, react-hook-form, zod, and the x/* Go modules. It also fixes a compatibility issue in the settings UI by switching Ant Design's Space usage from the deprecated `direction` prop to the current `orientation` prop.
  • fix(install): stop copying tuic-server over /usr/local/bin
    install_tuic_server copied the downloaded sidecar onto
    /usr/local/bin/tuic-server with cp -f, replacing an operator's own
    tuic-server install. The panel resolves bin/tuic-server first
    (GetBinaryPath in internal/tuic/process.go) and never reads that copy, so
    the copy could only ever clobber a foreign binary.
  • fix(tuic): evict the oldest relay flow instead of refusing new clients
    udpRelay.flowFor returned "max relay flows reached" once the table held
    maxRelayFlows entries, and only the idle sweep (every minute, two-minute
    cutoff) freed slots. One host sending a single datagram from each of 4096
    source ports therefore locked every new TUIC client out of the inbound for
    up to two minutes, repeatably. A full table now evicts the flow last seen
    longest ago, which under such a flood is one of the junk flows, and the
    newcomer is admitted. TestUDPRelayFullTableAdmitsNewClient fails on the
    refusing code with a read timeout for the third client.
  • refactor(panel): drop two duplicated helpers
    SettingService.GetDefaultJSONConfig was a byte-identical copy of
    GetDefaultXrayConfig with no callers anywhere in the tree.
    
    amneziawgnet.normalizeDNSServer re-implemented the exported
    amneziawg.NormalizeDNSServer line for line, in a file that already imports
    that package for EffectiveMTU three lines above it. Its two callers now use
    the exported one, so the bare-IP-to-host:port rule has a single definition.
  • fix(ui): keep the empty-group placeholder legible in dark mode
    The "no group" em dash in the clients table and in two client-picker
    modals was drawn with an inline color: rgba(0,0,0,0.45). The panel renders
    every page under antd's darkAlgorithm as well, so on a dark container that
    near-black placeholder is effectively invisible.
    
    All three now use Typography.Text type="secondary", the idiom the rest of
    the panel already uses for muted text — GroupAddClientsModal itself uses it
    58 lines further down.
    
    Mid-greys such as #888 elsewhere in the panel stay legible in both themes
    and are deliberately left alone.
  • refactor(tgbot): extract the shared numeric keypad builder
    Six callback flows — limit_traffic, reset_exp, ip_limit and their
    add_client_* counterparts — each carried the same 28-line inline keyboard:
    cancel, confirm, the 1-9 grid, clear, 0 and backspace. Only the callback
    prefix, the threaded email argument, the cancel target and the confirm
    label key ever differed, and the labels had already drifted apart between
    otherwise identical flows.
    
    numericKeypad now builds that grid from a numericKeypadSpec, cutting 168
    lines to 6. The callback data is unchanged: every one of the 84 strings
    and all 6 label keys were diffed against the pre-refactor router and are
    byte-identical, which matters because encodeQuery hashes any query over
    64 chars and buttons already sitting in a user's chat carry these
    strings.
  • perf(clients): batch the client record lookup in bulk operations
    BulkResetTraffic resolved every address with its own GetRecordByEmail
    call, one SELECT per email, purely to find the disabled clients it has to
    re-enable. Resetting 30 clients issued 30 queries before the batched
    transaction even started, while BulkAdjust, BulkDelete and BulkSetEnable
    next to it already loaded their rows with a single chunked IN query.
    
    Those three carried a verbatim copy each of both the trim/dedupe loop and
    the chunked record load, so the reuse is the fix: trimmedUniqueEmails now
    delegates to the existing uniqueNonEmptyStrings, and clientRecordsByEmail
    holds the one chunked lookup all four call sites share.
    
    A DB failure during the lookup now aborts the reset instead of being
    swallowed per email; a missing row is still skipped, as before.
    
    The new test drives BulkResetTraffic with 3 and with 30 emails and fails
    unless both issue the same number of SELECTs against clients.
  • chore(frontend): bump React and Zod deps
    Update frontend dependencies to React/ReactDOM 19.3.0, Zod 4.6.1, and matching React type packages. Also replace Storybook addon-vitest override placeholders with explicit Vitest/browser-playwright versions to keep dependency resolution stable.
  • fix(amneziawgnet): wait for the client netstack goroutines before closing its device
    TestPortForwardRoundTripTCPAndUDP flakes in the race job: closing the test's
    client WireGuard device races the goroutines still writing into its netstack.
    
    amneziawg-go's device.Close() calls tun.Close() before it stops the routine
    draining the tun, and netTun.Close() closes the unbuffered incomingPacket
    channel that WriteNotify sends on. A goroutine still inside a netstack write
    when the deferred clientDev.Close() runs therefore closes and sends on the same
    channel -- reported as a data race, and on a bad interleaving a "send on closed
    channel" panic.
    
    The TCP echo listener, its per-connection copies and the UDP echo all write into
    clientNet, and teardown only closed the two listeners before the device: nothing
    waited for the goroutines themselves. A WaitGroup deferred right after
    clientDev.Close() supplies the missing edge, since LIFO then puts the wait
    between the listener closes and the device close.
    
    Confirmed by flooding the existing UDP echo goroutine under GOMAXPROCS=1 and 2,
    which failed 3/6 and 2/6 runs with the stack CI reported and 0/12 with the fix.
  • feat(xray): update xray-core to v26.9.9 and follow the udpHop move
    Bump xtls/xray-core to 52a412d9e2f5 (v26.9.9) and the three binary pins in
    DockerInit.sh and release.yml in lockstep.
    
    Upstream moved UDP port hopping out of finalmask.quicParams.udpHop and into a
    standalone "udphop" UDP mask with a different shape (mode / interval /
    remotePorts / remoteIPs). The old key is gone from QuicParams, and since the
    config loader ignores unknown fields it is now silently dropped rather than
    rejected — port hopping just stops.
    
    The panel adapts where that key was live:
    
    - Both link importers rebuilt quicParams.udpHop from the standard mport param,
      so an imported hysteria2 link produced an outbound that no longer hops. They
      now emit a udphop mask in intervalremote mode, which is what the old key did.
      The mode is required: UDPHop.Build() rejects an empty or unknown one.
    - validFinalMaskUDPTypes and UdpMaskTypeSchema learn "udphop", otherwise the Go
      link generator strips the mask from every link and sub, and Zod strips it on
      the next form round trip.
    - mport generation (Go and frontend) reads the mask first and keeps reading the
      legacy key, so inbounds stored before the upgrade still advertise their range.
    
    On an inbound the old key was always inert — only hysteria's dialer consumed
    it — so nothing regresses server-side and no migration is needed. udphop stays
    out of the mask dropdown on purpose: it is client-only in core, which refuses
    to wrap a server socket, and that form is shared with the inbound editor.
  • fix(amneziawg): let a cleared header protection key reach a running device
    amneziawg-go reads an absent UAPI line as "keep the current value", and
    addressFingerprint keys only on the addresses and MTU, so an obfuscation-only
    edit reconfigures in place rather than rebuilding. Clearing headerProtectionKey
    therefore never took effect: the device kept protecting headers with the old
    key. The stale key also keeps the S1-S4 minimum in force, so lowering S3/S4 in
    the same edit made every later IpcSet fail with -22 — after replace_peers had
    already dropped the peers.
    
    Send the all-zero key when the field is empty, which is how the UAPI expresses
    "disabled"; an empty value would be rejected, since it decodes to zero bytes.
  • fix(settings): show the SMTP failure reason instead of a raw i18n key
    classifySMTPError returned keys already carrying "pages.settings.", while the
    four keys TestConnection returns directly do not, and the alert renders every
    Message under that one prefix. Any classified failure therefore looked up
    pages.settings.pages.settings.smtpErrorAuth, which does not exist, so the panel
    printed the key instead of "Authentication failed — check username and
    password". The unknown case was worse: it appended the raw error to the key, and
    its own text interpolated {{ .Error }}, Go template syntax the frontend's
    i18next never fills.
    
    Return the keys unprefixed like the rest, and point the unknown case at the
    panel log, which already carries the underlying error.
  • fix(dns): stop offering a port field that DoH entries discard
    Xray ignores port for DoH/DoHL/DoQL, so valuesToWire deliberately stores none
    for an encrypted address and a non-standard port has to go inside the URL. The
    form kept offering the field anyway, pre-filled with the 53 from its own
    defaults: a port typed there was dropped on save and redrawn as 53 on reopen,
    which reads as the panel losing the value.
    
    Render the port field only where it is actually stored. DoT keeps it, since
    tls:// is not an encrypted-address scheme for this purpose.
    
    Closes #6403
  • fix(amneziawg): stop losing an inbound and its server keys on the API path
    Two saves that the panel UI never makes, but the documented REST API does.
    
    A client whose allowedIPs normalized to empty passed validation, then
    InstanceFromInbound skipped the peer and dropped the whole instance when it was
    the only one. Nothing logged it, so an enabled inbound simply never opened its
    socket. Refuse an enabled peer with no address, naming the client, the way the
    injection and collision checks already do.
    
    The server keypair was regenerated whenever a payload omitted privateKey, which
    invalidates every client config already distributed, and a payload carrying only
    privateKey left publicKey empty so rendered configs got a blank "PublicKey =".
    An omitted key now means unchanged: the stored pair is carried forward, a
    half-supplied pair has its public half derived, and generation is reserved for
    an inbound that has no stored keys at all. UpdateInbound loads the stored row
    before normalizing so those keys are available.
    
    Closes #6407
  • fix(sub): drop Reality parameters when a host forces plain TLS
    A Host row may set Security to tls on an inbound whose own stream is Reality.
    The emitted link then carried security=tls next to pbk, sid, spx and the
    Reality dest as sni: the endpoint no longer performs a Reality handshake, so
    those describe a server the client will never reach, and clients that honour
    them fail to connect. Only the security key was rewritten at emit time, and the
    existing strip covered alpn/sni/fp/pcs for forceTls=none alone.
    
    Clear the Reality-only parameters before the endpoint's own TLS overrides are
    applied, so a host that supplies its own sni or fingerprint still wins.
    
    Closes #6424
  • fix(clients): keep per-peer keys when a client spans several tunnel inbounds
    A client attached to several WireGuard/AmneziaWG inbounds is that many
    independent peers, each with its own keypair, preshared key and tunnel address.
    The client edit form can only represent one peer, so Update's per-inbound loop
    stamped that single field set onto every attached inbound: every peer ended up
    with identical keys and one inbound's address, and the tunnels on all the other
    nodes stopped working with no way to recover the overwritten values from the
    panel. The only guard covered AllowedIPs, and only for AmneziaWG.
    
    When more than one tunnel inbound is in scope and the caller sent no per-inbound
    override, clear the shared peer fields so UpdateInboundClient's existing
    carry-forward preserves each inbound's own. A scoped update (?inboundIds=) still
    narrows to one inbound and edits it normally.
    
    Closes #6372
  • fix(inbounds): let a node-adopted inbound keep its own protocol on edit
    UpdateInbound restores the stored NodeID before the node-eligibility check, so
    the payload can never introduce an assignment there — the check could only ever
    fire on a row that already had one. A node's MTProto inbound arrives on the
    master by adoption, which does not go through that check, so every later edit of
    it was refused with "mtproto inbounds cannot be assigned to a node". That made
    the share address of a node-managed MTProto inbound impossible to change from
    the panel that generates its subscription links.
    
    Refuse only a protocol change into an ineligible protocol, which is the one way
    an update can still strand a row the master's sidecar loops would never
    reconcile.
    
    Closes #6415
  • fix(clients): withdraw the delete tombstone when the email is re-created
    Deleting a client tombstones its email for 90s so a node snapshot captured
    before the deletion cannot resurrect it. Nothing withdrew that tombstone when
    the operator re-created the same email, so on a master with at least one node
    the next merge filtered the live client out of the snapshot and SyncInbound
    pruned its inbound link. The client reappeared only once the tombstone expired,
    which is the 90-120s detach window reported.
    
    Withdraw it on a successful create, single and bulk, so a tombstone can never
    outlive the identity it was meant to bury. A failed create still leaves it
    standing, which is what keeps the stale-snapshot guard intact.
    
    Closes #6370
  • fix(sub): emit a bare host in Clash proxies
    A Clash "server" is a bare host, not a URI authority, but the custom share
    address strategy stores an IPv6 literal with brackets so the address normalizer
    can hand it to the raw link generators. The Clash renderer copied that value
    into every proxy verbatim, so mihomo received server: "[2001:db8::1]" and
    failed to parse the node. Raw links were unaffected because joinHostPort strips
    the brackets and re-adds exactly one.
    
    Strip them once where the renderer takes the resolved dest, which is the single
    place all three proxy builders read the address from.
    
    Closes #6373
  • refactor(ci): add an adversarial pass and name the analyst briefing
    REVIEW.md told the reviewer which repository rules to check but never to try
    breaking the change, so the conditions this panel actually meets went
    unexamined. "Try to break it" adds six, each tied to a mechanism here rather
    than to a generic checklist: an upgrade over an operator's existing rows and
    the rollback that reads them again, a restart that drops in-memory state under
    the cron jobs, a sub-node racing the master on the same row, an operation
    applied twice, an inbound or client at the empty and the thousand end, and a
    dependency that is down. It closes with the gate that running a case is not
    reporting it - each one still has to clear the verification bar below it, so
    the section cannot become a licence for hypotheticals.
    
    repo-context.md said nothing about which bot reads it. Only the issue analyst
    does, since the review job's briefing moved inline in acf3603d, so it becomes
    issue-analyst-context.md and its title names the analyst instead of "the Claude
    bot". bot_context_test.go pins that path in a constant, so the rename carries
    through the constant, the four test names and the two comments that named the
    old file - one of which still said "the bot prompts", plural.
    
    Backticks come off mtg-multi in the new section: the same test file reads any
    hyphenated backticked token in REVIEW.md as a CI job name, and fails on one
    ci.yml does not define.
  • refactor(ci): review pull requests with one senior-engineer role
    The review job ran the official code-review plugin, which fans a pull
    request out to five Sonnet reviewers plus a Haiku scorer per finding and
    drops everything scored under 80, and the briefing file spent most of its
    lines overriding that plugin. Both are gone: the job hands one Senior
    Software Engineer prompt to the action inline, the way the issue analyst
    does, and denies the Agent tool so the single role is mechanical rather
    than a request.
    
    REVIEW.md moves from the emoji markers to CRITICAL/HIGH/MEDIUM/LOW with a
    pre-existing qualifier. The uncapped rule is scoped to findings the pull
    request introduced or worsened so it cannot collide with the cap of three
    pre-existing ones. "A finding is a report, not a patch" stays as it was.
    
    Workflow housekeeping: GH_TOKEN, REPO and PR live in the job env instead
    of six step copies; the skip gate is per pull request, so a head pushed
    after the automatic review is reviewed only on @claude review; the comment
    counters sum gh's per-page jq output, which read "0\n0" as a review on a
    pull request with more than 100 comments; --max-turns rises to 300 because
    every read now costs the single agent a turn instead of a subagent.
  • Update deps and simplify parsing
    Bump frontend and Go dependencies, then modernize a few hot paths with newer Go string/range helpers. Also widen the client form quota/limit fields to improve the layout.
  • feat(xray): update xray-core to v26.9.8 and adapt panel
    Bump xtls/xray-core to 37ceb8b4b6 (v26.9.8) and the three binary pins
    (DockerInit.sh, release.yml Linux + Windows) in lockstep. No deleted
    symbols; the impact is entirely on the JSON config surface.
    
    Outbound "proxySettings" is now refused by the config loader (moved to
    streamSettings.sockopt.dialerProxy) and a freedom outbound rejects
    sockopt.addressPortStrategy. Either key in a stored template would keep
    the core from starting after the upgrade, so a new OutboundRemovedKeysFix
    seeder rewrites xrayTemplateConfig once: proxySettings.tag becomes
    sockopt.dialerProxy (an existing dialerProxy wins) and addressPortStrategy
    is dropped from freedom outbounds. Template saves and outbound
    subscriptions already run through the vendored loader, so the new
    refusals surface there with the core's own message.
    
    REALITY no longer applies a built-in minClientVer (26.3.27) when the
    field is empty. The form placeholder and the min/max hints in all 13
    locales now say that empty means no minimum.
    
    New upstream keys the Zod schemas would otherwise strip, with form
    support where a sibling field already had it:
    - blackhole response type "custom" with base64 customResponseData
    - realm finalmask ipMode (dual/v4/v6) and portMapping (UPnP / NAT-PMP)
    - quicParams brutalDisableLossCompensation, disableChromeParrot,
      disableGSO, disableStatelessReset
    - hysteria masquerade proxy xForwarded
    - wireguard outbound remoteDNS
    - routing rule localOS
    
    freedom.domainStrategy is only deprecated upstream (auto-migrated to
    sockopt.domainStrategy with a warning) and is left untouched.
  • perf(node): bound the per-client node push and fan out the traffic reset
    An operator with several nodes reported that editing a client or resetting
    its traffic takes more than ten seconds on the master. Measured against real
    Remote HTTP (fake node servers, one client per node), the healthy case is
    already fast — 3 nodes: update 51ms, delete 51ms; 5 nodes: 102ms / 103ms —
    but two things were not:
    
      - ResetTrafficByEmail still walked its inbounds one node round-trip after
        another: 152ms at 3 nodes, 253ms at 5, linear in node count.
      - Every per-client op blocked on the SLOWEST node's push. With one node
        answering in 3s, update/delete/reset all took 3003ms regardless of node
        count. A node that answers the 4s heartbeat probe but hangs on the push
        stays "online", so every edit waited on it up to remoteHTTPTimeout — the
        ten seconds in the report. More nodes only raise the odds one is sick.
    
    The push is an immediacy optimisation, not the source of truth: every one of
    these ops calls MarkNodeDirtyTx inside the transaction that commits the
    change, before it pushes, and the node reconcile job converges a dirty node on
    its next 5s tick by re-sending the inbound whose fingerprint was not advanced.
    So bound the synchronous push with nodeClientPushTimeout = 4s — the budget the
    heartbeat and traffic-sync jobs already treat as "responsive" — at the eight
    node-branch push sites. A node that does not answer in time is left dirty and
    converged a few seconds later instead of stalling the request; the tag-cache
    list fetch inside resolveRemoteID shares the same budget.
    
    Once one push in a batch has timed out, the rest of that inbound's batch now
    stops pushing too, as AddInboundClient already did: the node is dirty and one
    reconcile converges the whole inbound. Deleting three clients on one hung node
    went from 30.08s (three remote timeouts) to 4.06s; at the 32-client push
    threshold that is 128s of deadlines saved per inbound.
    
    Fan the reset out through fanoutInboundApplies like the other client ops. Its
    node propagation is still attempted whatever the node's status flag says, as
    before, because nothing replays a traffic reset — the reconcile pushes inbound
    config, not counters — so a node still serving after being marked offline must
    receive it now or never.
    
    Trade-offs stated plainly: a node that would have answered in 4–10s now falls
    to the reconcile's full-inbound push, which on the node is a delete+add of the
    inbound and drops its sessions there — the same fallback a failed 10s push
    already used, now reached sooner. The reset stays best-effort with no retry
    path, which predates this change. The response still reports success while a
    timed-out node catches up; the pending-node badge is keyed off node status by
    design, so only the warning log records it.
    
    Tests: a barrier test that a sequential reset cannot satisfy; two tests against
    a real runtime.Remote and an httptest node that hangs on the push, pinning that
    an edit returns at the deadline (exactly one push reached the node, the node
    is left dirty) and that a bulk delete stops after its first timed-out push.
    All red without the change; the two hung-node tests pay their 4s deadline on
    every run.
  • perf(clients): push a bulk client change to every node at once
    63b46cd6 made a multi-inbound client create apply its inbounds concurrently,
    and d34ec97f did the same for the single-client update, delete and detach. The
    bulk operations were never converted, so they still walked their inbounds in a
    plain sequential loop with a node RPC in each iteration — and those are what the
    panel actually calls for a multi-select delete or an enable/disable, which is
    why editing and deleting still felt slow on a master with several nodes.
    
    Measured with a node runtime injecting 100ms per RPC, one client per node:
    
      nodes=1  update=101ms  bulkSetEnable=101ms  bulkAdjust=101ms  bulkDelete=101ms
      nodes=3  update=102ms  bulkSetEnable=302ms  bulkAdjust=304ms  bulkDelete=303ms
      nodes=5  update=203ms  bulkSetEnable=504ms  bulkAdjust=504ms  bulkDelete=504ms
    
    after, all of them track the single-client ops:
    
      nodes=3  bulkSetEnable=103ms  bulkAdjust=101ms  bulkDelete=101ms
      nodes=5  bulkSetEnable=202ms  bulkAdjust=202ms  bulkDelete=202ms
    
    Generalize the fanout into fanoutInboundResults over an arbitrary per-inbound
    result type and route six loops through it: BulkDelete, BulkSetEnable,
    BulkAdjust, BulkDetach, BulkAttach, BulkCreate, plus applyClientFieldByEmail —
    the field edit behind the Telegram bot's enable/limit/expiry buttons and the
    LDAP job. Each keeps its preparation sequential and overlaps only the node
    pushes, inheriting the same concurrency cap and per-inbound panic recovery.
    
    Two ordering details the sequential loops got for free and the fanout must do
    itself: the three loops that ranged a map now walk sortedInboundIds, so which
    inbound wins a per-email skip reason is the lowest id instead of whatever the
    map yielded; and BulkAttach de-duplicates a repeated inbound id up front,
    because the second pass used to see the client the first pass had just added.
    
    The allocating paths stay serial when a tunnel inbound is involved. WireGuard
    and AmneziaWG pick a free peer address by reading every inbound's used-set
    before they write, so two overlapping allocations hand out the same address and
    the in-transaction re-check refuses the loser — a bulk create of two clients
    onto two wg inbounds returned created=1. addFanoutLimit drops those batches back
    to one at a time; every other protocol keeps the full cap.
    
    Eight tests: seven barrier tests that a sequential caller cannot satisfy (peak
    pushes in flight is 1 without the change, 4 with it), and one that pins the
    tunnel allocation.
  • fix(node): flag every hosting node before a client edit applies
    A client edit fans out one transaction per inbound, and each one renames the
    single shared clients row but calls MarkNodeDirtyTx for only its OWN node. So
    between the first and the last commit the record already carries the new email
    while every other node hosting that client is still config_dirty = false.
    
    setRemoteTrafficLocked gates the snapshot merge on that flag, so a merge landing
    in the gap is accepted, sees a pre-rename snapshot, finds no record for the old
    email and inserts one through syncInboundClients' CreateInBatches — the only
    place in the panel that creates a client record. The ghost is never in any later
    merge's perInboundOld, so markSyncOrphan never fires and ReapSyncOrphans never
    collects it: the operator is left with a permanent second client under the old
    name. The same stale merge reverts an expiry-only edit instead of duplicating it.
    
    Mark every node hosting the client dirty in one serialized write before the
    fanout starts, so a merge queued behind it skips the node instead of merging a
    half-applied edit. The nodes were going to be marked by their own applies
    anyway; doing it up front only moves it earlier, and a client on local-only
    inbounds never reaches the writer at all.
    
    The set is the client's FULL attachment list, taken before the inboundIds
    filter narrows it: the rename rewrites the one shared record, so an inbound the
    filter excluded goes stale too.
    
    Two tests, both red without the change. The first pins the ordering rather than
    the end state — it reads the watched node's flag from inside another inbound's
    push, so moving the marking after the fanout turns it red. The second pins that
    the filtered path still covers the excluded node.
    
    This narrows the window rather than closing it everywhere. A reconcile tick can
    still clear the flag mid-fanout, and on a filtered edit the excluded inbound
    keeps the old email in its settings for good, so its next merge duplicates
    again. The case-drift path — a node reporting another case of a known email —
    is untouched and still duplicates.
  • fix(clients): flag the restart a partly-applied edit or delete still needs
    63b46cd6 made a multi-inbound client op apply its inbounds concurrently and
    stop aborting at the first failure, so an error can now come back together
    with needRestart=true: the inbounds that succeeded committed real changes and
    their Xray still needs the restart. That commit taught the two callers it
    converted — create and attach — to read the flag before the error check.
    
    d34ec97f then routed Update, Delete, Detach and DeleteByEmail's record-less
    fallback through the same fanout but touched no caller, so on a master with
    several nodes a partly-applied edit or delete returned (true, err) into a
    handler that returned on err first. Xray was never flagged for the work that
    landed and notifyClientsChanged never fired, so the running config kept
    serving the pre-edit client set and every open panel showed stale rows until
    something else happened to trigger a restart.
    
    Read needRestart before the error check in update, delete and detach, and
    broadcast on needRestart || err == nil — the same shape create and attach have
    had since 63b46cd6. The predicate is a strict superset of the old err == nil,
    and needRestart is only ever assigned after a runSerializedTx commit, so it
    firing genuinely means something landed.
    
    The three handlers are pinned by a new controller test each: one client on two
    inbounds, the second one's settings JSON corrupted so the op commits on one and
    fails on the other, asserting both the success:false response and the restart
    flag. All three fail without the change.
    
    The API docs for update, del and detach now describe the partial-application
    contract, as add and attach already did. Detach ends at the fanout so every one
    of its errors carries the inbound prefix; update and delete write the client
    record afterwards, and a failure there is reported without one.
  • fix(tgbot): use a token telego accepts in the edit-message tests
    telego.NewBot validates the token against `^\d+:[\w-]{35}$` before any
    option is applied, so the "test-token" literal in the two
    not-modified tests failed with "telego: invalid token format" and the
    go-test and race jobs went red on every run since #6340. Use a
    placeholder token that matches the format; the tests now reach the
    mock API server, pass with the guard in place and fail without it.
  • fix(amneziawg): reject obfuscation values amneziawg-go's own UAPI rejects
    ValidateObfuscation exists, by its own doc comment, so that a bad manual
    entry cannot break the embedded device's IpcSet. It was not covering enough
    to do that. Auditing the panel against amneziawg-go v3.1.20260828's full
    UAPI surface turned up two holes, both confirmed by driving the values
    through a real IpcSet:
    
      S1 = 70000        upstream parses s1-s4 as uint16
      S2 = 70000        (device/uapi.go)
      Jc = -1           jc/jmin/jmax are uint32, so no negatives
      Jmin/Jmax = -5/-1
      Jc = 5000000000   and nothing wider than uint32
      I1 = <rand 100>   newObfChain hard-fails on an unknown tag
      I1 = <r 100       ... and on a missing '>'
      I1 = <>           ... and on an empty one
    
    All eight passed validation and were then rejected by the device. Only S3
    and S4 were bounded, which is why the asymmetry went unnoticed. The inbound
    saves, the reconcile fails on every tick, and the interface never comes up
    with a single log line to say so.
    
    Bound the five numeric fields to the widths upstream actually parses, and
    check the I1-I5 chain's <tag value> structure against a tag set mirroring
    upstream's own obfBuilders map. Each tag's value grammar stays amneziawg-go's
    to enforce -- that is eight builders across several files, and duplicating
    them here would drift. So <r abc> still reaches IpcSet, now as the only
    remaining class rather than one of four.
    
    Mirror the same bounds in the Zod schema, next to the max() that s3 and s4
    already carried, so the form rejects the value instead of the save doing it.
    
    TestValidatedObfuscationAlwaysApplies pins the contract itself: whatever
    ValidateObfuscation accepts, a real amneziawg-go device must accept too. It
    covers the specs the new grammar check deliberately allows, not just the ones
    it rejects, so the allowlist cannot quietly become stricter than upstream.
    
    The rest of the audit found no gaps: all 17 settable device keys reach
    buildUAPIConfig, ServerSettings, the Zod schema and all three .conf
    emitters. fwmark and persistent_keepalive_interval remain unemitted, both
    deliberately -- the panel models no fwmark anywhere, and keepAlive is carried
    client-side where WireGuard puts it.
  • fix(amneziawg): three defects in the embedded relay's connection handling
    Half-close. Both TCP relays -- RelayTCP into Xray's SOCKS5 inbound and
    relayTCPForward into a peer's tunnel address -- waited on a single `done`
    receive and then closed both sides. A client that finished sending and shut
    down its write side therefore had the connection torn down before the
    response came back. pipeBothWays now runs both directions to completion and
    propagates the half-close via CloseWrite (which *net.TCPConn and
    *gonet.TCPConn both implement), falling back to a full Close for anything
    that does not.
    
    Waiting for both directions reintroduces the risk the old single-receive was
    implicitly avoiding: a peer that vanishes mid-transfer would pin the pair
    forever. guardedReader bounds that, but as an idle window rather than a
    total one -- the deadline is re-armed on every read once armed -- so a slow
    transfer is never cut, while a silent peer is. Two minutes matches the idle
    window UDPRelay.pump and portForwardUDPIdleTimeout already use.
    
    UDP session retirement. pump's teardown deleted the map entry by key alone,
    so a session that lost a create race evicted whichever session currently
    held that source, orphaning a live flow. It now retires only its own entry,
    and Handle keeps the already-published session when it loses the race. The
    map is keyed on netip.AddrPort rather than src.String(), matching
    udpForwardListener next door and dropping one allocation per relayed
    datagram.
    
    SOCKS5 reply decoding. bytesReader had a value receiver, so each Read
    restarted at the head of the slice, and receive never advanced past a
    domain-form address because its switch only handled ATYP 0x01 and 0x04 -- a
    0x03 reply decoded to a wrong source, port and payload. splitSocks5Addr
    replaces it: all three address forms, length-checked at every step, with the
    domain form accepting only a literal. Resolving there would have put a
    blocking DNS lookup on the receive path, and a datagram's own source is an
    address already. Unreachable against Xray's own inbound, which always
    answers with an IP, so this is a latent-bug fix rather than an observed one.
  • perf(amneziawg): return gVisor's pooled buffers on the embedded data path
    Every packet crossing the embedded AmneziaWG interface allocated instead of
    reusing gVisor's pools, in both directions. stackTun.Write injected each
    decrypted packet and never called DecRef, so the packet buffer and its chunk
    were never returned; stackTun.Read copied each view out and never released
    it. gVisor's own link endpoints settle the ownership question -- loopback.go
    and sharedmem.go both DecRef immediately after DeliverNetworkPacket, because
    the injector owns the buffer.
    
    AttachUDPHandler compounded it by cloning a packet buffer it then dropped on
    the floor, on top of a Data().AsRange().ToSlice() that already returns an
    owned copy, so the clone bought nothing and stranded a pooled buffer plus a
    cloned view per datagram.
    
    Measured with the benchmarks added here:
    
      stackTunWrite (upload)     794ns -> 107ns   4 -> 0 allocs
      stackTunRead  (download)   707ns -> 129ns   3 -> 0 allocs
      UDP datagram, end to end  2.69us -> 1.58us  8 -> 2 allocs
    
    The remaining UDP allocation is the ToSlice copy itself. Through a real
    handshaked tunnel -- both devices in one process over loopback, so
    ChaCha20-Poly1305 and the UDP syscalls dominate -- it is worth -48% bytes/op
    and -33% allocs/op, and about +4.8% throughput in each direction (n=18,
    p<=0.01). On a small VPS, where the allocation pressure is not spread over
    24 idle cores, the throughput share should be larger; that part is reasoning,
    not something measured here.
    
    The three regression tests assert allocations per packet rather than timing,
    since the defect is the pool miss, not the nanoseconds. Thresholds leave room
    for the extra allocation -race adds.
  • perf(node): push a client edit to every node at once, not one after another
    Editing, deleting or detaching a client on a master with several nodes took
    one node round-trip per node, added end to end. Create and Attach already
    fanned their per-inbound applies out through fanoutInboundClientAdds, but
    Update, Delete, Detach and DeleteByEmail's record-less fallback still walked
    their inbounds in a plain sequential loop, and each iteration blocks on a
    node RPC (10s timeout, more when a node is slow or has just gone unreachable
    and the heartbeat has not marked it offline yet).
    
    Measured with a node runtime injecting 100ms per RPC, before:
    
      nodes=1  create=101ms  update=101ms  delete=101ms
      nodes=3  create=102ms  update=303ms  delete=302ms
      nodes=5  create=202ms  update=504ms  delete=504ms
    
    after, all three track create:
    
      nodes=3  create=102ms  update=102ms  delete=101ms
      nodes=5  create=203ms  update=203ms  delete=203ms
    
    Generalize the existing helper into fanoutInboundApplies over an inboundApply
    list and route the four remaining loops through it, so they inherit the same
    concurrency cap, per-inbound panic recovery and joined errors. Each caller
    still builds its payloads sequentially first: fillProtocolDefaults mints the
    shared credentials on the first inbound and every later one reuses them, so
    that order has to stay deterministic. Only the applies overlap; their DB work
    still serializes through the single traffic writer, and the per-inbound
    mutation lock is unchanged, which is exactly what Create has relied on.
    
    Behaviour change: one failing inbound no longer aborts the remaining ones,
    matching what Create already does. The error still names each failed inbound
    and the record-level writes are still skipped when any inbound failed.
    
    The snapshot merge on the same serialized writer was measured as a second
    suspect and cleared: ~43ms per node at 500 clients, an order of magnitude
    below the RPC serialization.
  • docs(readme): refresh all seven READMEs for the current feature set
    The READMEs had not moved since 2026-07-07, 341 commits ago, and had
    drifted far enough to misdescribe the panel: AmneziaWG and MTProto
    inbounds were missing from the protocol list entirely, the outbound
    list predated PIA, and the API section still advertised Swagger rather
    than scoped, optionally expiring tokens.
    
    Add the two missing protocols plus a bullet each for what makes them
    notable — AmneziaWG runs on the embedded userspace netstack, so unlike
    the DKMS/awg-quick shape it originally shipped with there is nothing to
    install, and MTProto client edits hot-apply through the mtg-multi
    management API instead of bouncing the process. Fold the smaller
    additions into the bullets they belong to (HWID device limits, IP-limit
    exemptions, renewal cycles, inbound cloning, balancer-to-balancer
    fallback, geosite/geoip browsing, named subscription formats) and add
    one for PWA installability.
    
    Point documentation at docs.sanaei.dev, which the panel sidebar already
    links to and which supersedes the wiki, using each README's own locale
    where the docs site has one (fa/ru/zh). Bump the pinned install example
    to the current stable tag, note the .sha256 verification install.sh and
    update.sh now perform, and document XUI_NODE_TOKEN_KEY_FILE /
    XUI_NODE_TOKEN_KEY, which no markdown in the repo covered.
    
    All seven files move together so the language picker keeps pointing at
    equivalent documents.
  • style(node): tighten the comments and probe assertion from the QA pass
    Two follow-ups on the preceding fixes, no behaviour change:
    
    - The sweep comment in inbound_node.go had grown to a contiguous six-line
      block, over the two-line maximum. The prefix rationale it carried is
      already stated by nodeSelectedTagSet itself and by 6f40a51d's message.
    - The probe cap test asserted only that an error came back, which cannot
      tell a size rejection from a transport failure or a success=false
      envelope. It now pins LastError to the decode rejection.
    
    Both remain red-first: neutralizing maxProbeBodyBytes still fails the probe
    test on the new assertion.
  • fix(node): let a node-reported tag outrank a stale adopted alias
    The alias re-application added in 0775fcaa wrote every adoptedAliases entry
    onto the rebuilt map unconditionally, so an alias could override the id the
    node itself reported for that same central tag. adoptedAliases is never
    pruned — cacheDel clears remoteIDByTag and pushedFP only — so the entry
    outlives the pairing that created it.
    
    That inverts the intended precedence: once a push renames a node inbound to
    the central tag, the node reports it directly, and a stale alias pointing at
    some other inbound reusing the old name would win. Every state-changing op on
    that inbound then targets the wrong one, overwriting or deleting an inbound
    the operator created separately.
    
    The alias now only fills a gap: a central tag the node already reports is
    left alone.
  • fix(node): cap the status body the heartbeat probe decodes
    probe decoded the node status response with json.NewDecoder(resp.Body) and no
    size limit. encoding/json buffers the whole value before decoding, so the
    allocation was dictated by the peer regardless of how few fields the envelope
    declares — and the heartbeat job probes up to 32 nodes concurrently on a 4s
    budget with no client-level timeout.
    
    The sibling RPC path already caps every node response at 64 MiB
    (readCappedBody in internal/web/runtime), so this was the one uncapped read
    of node-controlled data. A status envelope holds a handful of scalars, so the
    cap here is 1 MiB rather than the RPC figure.
    
    The peer is untrusted in the skip and pin TLS modes, and the same decode is
    reachable from the nodes test and probe endpoints.
  • fix(node): keep an adopted inbound alias across a remote id cache refresh
    AdoptInboundAlias maps a central tag onto a node inbound that carries a
    different name, recording the pairing in both remoteIDByTag and
    adoptedAliases. refreshRemoteIDs then rebuilt remoteIDByTag from the tags the
    node reports and nothing else, so the central-tag entry was dropped on the
    next cache miss for any other tag.
    
    After that every op on the adopted inbound failed to resolve, and UpdateInbound
    falls back to AddInbound — creating a duplicate inbound on the node at the same
    port. cacheGetTag only recovers an n<id>- prefix flip, never an arbitrary
    alias, so the pairing could not be rediscovered until a master restart.
    
    The rebuild now re-applies adoptedAliases onto the fresh map, which keeps the
    map the single place a tag is resolved from.
  • fix(node): sweep a selected inbound the node reports without its prefix
    In "selected" sync mode the reconcile sweep built its set of managed tags
    verbatim from node.InboundTags. A panel-created node inbound is stored with
    an n<id>- prefix (composeInboundTag) and pushed to the node with that prefix
    stripped (wireInbound), so the tag the node reports never matched the set and
    the sweep skipped it.
    
    The effect is the case the sweep exists for: an operator deletes a node
    inbound while the node is offline, and the node keeps serving it — and its
    clients — indefinitely. Only unprefixed tags were unaffected, which is why
    the existing selected-mode test did not catch it.
    
    nodeSelectedTagSet already builds both tag forms for exactly this reason and
    is used by the snapshot filter; the sweep now uses it too, so the two agree.