Commit Graph
100 Commits
  • fix(sponsor): fetch sponsor data from raw.githubusercontent.com
    The server-side fetch used sponsors.sanaei.dev, a hostname unique to
    3x-ui. Without ECH it travels in plaintext SNI, so an on-path observer
    could tag a server as running the panel from that one connection.
    raw.githubusercontent.com is shared by countless tools and reveals
    nothing. The path stays inside TLS. The data source is unchanged: the
    same MHSanaei/sponsors repo.
    
    Refs #6824
  • feat(mtproto): expose mtg-multi's per-IP pending-handshake limit
    mtg-multi v1.16.0 adds [defense.pending-handshakes] max-per-ip, which
    closes new connections from an IP already holding that many
    unauthenticated handshakes, so one address cannot pin the workers other
    clients need. The MTProto inbound form now carries it as
    pendingHandshakesMaxPerIp; the key is written only when set above 0, so
    existing inbounds render a byte-identical config and are not restarted.
    A change to it moves the structural fingerprint and restarts the sidecar.
    
    dry-run is left out on purpose: it only feeds the pending_handshake_limit
    Prometheus metric, which the panel does not surface. The hint warns that
    clients behind carrier NAT share the limit.
  • fix(xray): capture whole core crash reports instead of the first pipe chunk
    LogWriter inspected each pipe chunk on its own. The Go runtime writes
    "panic: " with a separate write before the message and traceback, so the
    crash report was written from that first chunk alone and the panel left
    7-byte core_crash_*.log files holding only "panic: ". Any ordinary log
    line mentioning panic/exception/stack trace was also treated as a crash
    and dropped from the panel log.
    
    The writer now splits output into lines, starts a crash only on a line
    beginning with the Go runtime's "panic: " / "fatal error: " header, keeps
    everything after it, and writes one report from Flush, which
    waitForCommand calls after cmd.Wait has delivered all output. The header
    line becomes LastLine so GetResult shows the cause.
    
    The report filename format "_000000000" is not a Go fractional-seconds
    layout and always produced literal zeros, so reports from the same second
    overwrote each other; os.CreateTemp now gives every report a unique name.
  • chore(windows): update OpenSSL installer
    Replace the OpenSSL Light 3.6.0 executable with the 4.0.3 MSI installer.
  • fix(sub): export Hysteria2 Gecko obfs in Clash/Mihomo subscriptions
    A salamander finalmask carrying a packetSize range is Gecko obfs. The
    hysteria2:// link generators already export it, but buildHysteriaProxy
    copied only the password, so Clash/Mihomo received plain salamander and
    could never complete the handshake against a Gecko server.
    
    Emit mihomo's gecko form instead: obfs: gecko plus integer
    obfs-min-packet-size / obfs-max-packet-size, validated by the same
    parseHysteriaPacketSize bounds the URI export uses. A password-only mask
    keeps the plain salamander output.
    
    Closes #6822
  • feat(release): ship the Windows build as 3x-ui.exe with version info and icon
    Kaspersky (Trojan.Win64.Agent.sb / .smhqgz) and Defender flag the
    Windows build heuristically. A stripped, unsigned Go binary with no
    VERSIONINFO, icon or manifest scores high on those heuristics, so the
    release job now generates a resource .syso with go-winres from
    winres/winres.json, stamped with internal/config/version, before
    go build. The .syso is a build artifact and is gitignored.
    
    The Windows zip now carries 3x-ui.exe instead of x-ui.exe, matching the
    project name, and the executable embeds the 3X logo as its icon. The
    icon is a square 256px crop of media/3x-ui-dark.png, since the source
    logo is 400x200 and Windows icons must be square.
  • fix(xray): apply shadowsocks client changes in place instead of rebuilding
    The per-user hot path only covered vless, vmess, trojan, hysteria and
    masque, so every client change on a multi-user shadowsocks inbound - a
    node push for an auto-disable, renew, reset or add, a local Edit Inbound
    save, or a config-diff hot apply - fell through to DelInbound +
    AddInbound, closing the listener and dropping every live connection on
    the port.
    
    Shadowsocks joins userDiffableProtocols. The emitted user ops also carry
    the inbound's method as "cipher": 2022 clients have no method of their
    own, and without it AddUser cannot build the account, which would leave
    2022 inbounds rebuilding anyway. Changes outside settings.clients
    (method, 2022 server key, network) still differ in the rest of the
    settings and still rebuild.
    
    Verified against the pinned core: TestXrayAPI_E2E_Users and the
    shadowsocks e2e tests pass with XRAY_E2E_BINARY set.
    
    Closes #6820
  • fix(node-sync): write only changed client rows in the node traffic merge
    Every 5s node merge rewrote one client_traffics row and one
    node_client_traffics baseline per (inbound, client) pair the node
    reported, even when nothing had moved: a client is reported once per
    inbound it is on, and idle clients every tick. On top of that each
    inbound's SyncInbound wrote its own per-inbound values onto the shared
    clients record, so a client on a flow and a non-flow inbound (or on a
    WireGuard tunnel plus any other inbound) had its record flipped back
    and forth twice per merge. With 7 nodes and ~20k client links that is
    tens of thousands of statements per tick, all inside transactions on
    the single serialized writer, holding row locks for seconds. A renew
    of a client on 38 inbounds takes one writer turn per inbound, queued
    behind those merges each time, and outlived the 30s HTTP write timeout
    even though it committed; last_sub_fetch updates waited on the same
    locks.
    
    The merge now computes the row its UPDATE would leave, mirroring the
    SQL merge expressions, and skips the write when nothing changes; the
    baseline upsert is skipped when the node counter has not moved. The
    record's per-inbound fields get one owner each, so repeated syncs
    agree: flow is settled to the effective flow (lowest-id link carrying
    one) for clients whose links changed, and WireGuard/AmneziaWG peer
    fields come from the client's lowest-id tunnel. A repeated unchanged
    snapshot now writes no client row; one active client writes two.
    
    Verified beyond make verify: the CI Postgres lane, the merge and flow
    tests run against PostgreSQL 16, and make node-e2e.
    
    Closes #6815
  • feat(sponsors): drop the sidebar slot and simplify the Sponsors page
    The sidebar no longer carries a sponsor card. The backend stops serving
    the "sidebar" slot, so a sponsors.json entry that still lists it keeps
    only its other slots and one listing nothing else is dropped. Its
    rotation, three-sponsor cap and collapsed-rail logo rendering go with it.
    
    The Sponsors page now lists only real sponsors: the "Your brand here"
    card shows only as the empty state instead of sitting in the grid and
    repeating the header's Become a sponsor button, and the Available
    placements section and its slot-occupancy helper are removed. Cards are
    larger, two per row on wide screens. Unused i18n keys are dropped from
    every locale.
  • fix(sponsor): keep long sponsor copy inside every slot
    The Sponsors page card sized its body to max-content because the title
    never wrapped, so a long title spilled out of the card onto the next one.
    The compact card (sidebar, login) put logo, copy and close button in one
    row, leaving the copy ~110px of the 220px sidebar and clamping it to two
    lines; the dashboard banner cut its title to a single line.
    
    Titles and descriptions now wrap, breaking unbroken strings too. The
    compact card stacks logo and tag above copy that spans the full card
    width, keeping a bounded height in the sidebar with a 2-line title and
    4-line description clamp and the full copy in the link tooltip.
  • fix(database): blank boolean-era verifyPeerCertByName values on hosts
    A host's verify_peer_cert_by_name must only hold a server name an
    operator typed. The column started life as a boolean, and the migration
    that was meant to discard those values runs after AutoMigrate, which has
    already cast the column to text: SQLite's table rebuild stores 0/1 as
    "0"/"1", and Postgres' USING col::text stores "false"/"true". The
    migration then sees a text column and leaves the values alone.
    
    Since 3.10.0 the JSON subscription lifts host TLS verification fields to
    the level xray reads, so that leftover "0" is now sent as the cert name to
    verify and clients such as Happ refuse the server certificate.
    
    A one-shot HostVerifyPeerCertByNameBoolFix seeder blanks exactly the four
    cast values on existing databases; real names are untouched. The
    Postgres variant joins the CI schema job, since that cast only happens
    there.
  • fix(xray): fall back to the userspace TUN where kernel TUN cannot be set up
    The core puts a WireGuard outbound on a kernel TUN whenever it holds
    CAP_NET_ADMIN and noKernelTun is unset, the default for a hand-added outbound.
    That needs a writable /proc/sys/net and /dev/net/tun, and where either is
    missing the core does not fall back: it aborts the whole start. The shipped
    docker-compose grants NET_ADMIN for fail2ban while Docker keeps /proc/sys
    read-only and exposes no /dev/net/tun, so one such outbound took every inbound
    down with the #6796 error; any unit or drop-in that keeps /proc/sys/net
    read-only did the same.
    
    xray.KernelTunBlocked probes once, from the panel process whose capabilities
    and mounts the core inherits, whether the core would pick a kernel TUN it
    cannot create. GetXrayConfig then sets noKernelTun on every WireGuard outbound,
    so cold starts and hot reloads both get it. Hosts that can create the device
    keep the kernel TUN.
    
    Verified with the pinned core's "run -test" on the generated config, in a
    NET_ADMIN container as docker-compose runs it and under systemd 257: the
    container and the v3.10.0 unit report blocked and pass on gVisor, the container
    fails with the #6796 error when the GetXrayConfig hook is bypassed, and the new
    unit keeps the kernel TUN.
    
    Refs #6796
  • fix(systemd): let the WireGuard kernel TUN write rp_filter under the sandbox
    ProtectKernelTunables=yes (#6718) mounts all of /proc/sys read-only, and a
    WireGuard outbound in kernel-TUN mode zeroes net.ipv4.conf.all.rp_filter (and
    its ipv6 and per-device siblings) while Xray creates its handlers, so the core
    aborted with "failed to disable ipv4 rp_filter for all: ... read-only file
    system". The unit is reinstalled on every update, so a hand edit did not stick.
    
    Keep ProtectKernelTunables and reopen only /proc/sys/net. Turning the
    protection off (#6797) also lets the core start, but leaves kernel.core_pattern
    writable to the root panel, which turns any panel-level code execution into a
    way out of the whole sandbox. net.* is per network namespace and grants nothing
    beyond the CAP_NET_ADMIN the panel already holds.
    
    Verified on systemd 257 (Debian trixie) with the shipped unit and the pinned
    core: the v3.10.0 unit reproduces the error, the new one starts the kernel TUN,
    and kernel.core_pattern stays read-only for the service.
    
    Closes #6796
  • fix(ci): move the issue analyst's static instructions out of the workflow
    GitHub evaluates a `with:` value holding ${{ }} as one expression and
    rejects the whole workflow when it passes 21,000 characters. The analyst
    prompt was 19,883; 6eeaaa91 took it to 21,389 and 99d971ff to 23,257, so
    since that push the file is invalid: no issue gets an analysis, and every
    push records a failed, job-less run named after the file. actionlint does
    not check this limit, which is how it shipped.
    
    The static parts - repository context pointer, issue forms, how to
    investigate, resuming and maintainer-request modes, evidence discipline,
    the severity/confidence/verdict scales, the security exception, labels and
    closing, and the comment format - move verbatim to
    .github/claude/issue-analyst-instructions.md, which the prompt tells the
    analyst to read in full first, as it already does for
    issue-analyst-context.md. The prompt keeps everything that needs an
    expression or guards the run: the trigger mode, CURRENT ISSUE, the fenced
    untrusted data, RULES and the marker. It is now 5,597 characters. The
    stale "code changes happen when the maintainer mentions @claude" rule is
    replaced: no workflow here changes code, and @claude analyze now exists.
    
    TestBotPromptsFitGitHubExpressionLimit in bot_context_test.go reads every
    claude-*.yml and fails on a ${{ }} value over the limit; it is red on
    99d971ff (23,257). The instructions file joins the analyst paths pinned by
    TestAnalystContextNamesRealPaths, and the file's header now names
    everything it pins. actionlint 1.7.7 passes.
  • feat(ci): let a maintainer re-run the issue analyst with @claude analyze
    The analyst ran only on a new issue or on the reporter's reply to a
    "clarification needed" question, and a comment mentioning @claude was
    explicitly skipped. A maintainer had no way to get a fresh analysis after
    the code moved, after the prompt improved, or to point it at a lead; the
    only option was re-running the old job, which replays the old commit and
    the old prompt.
    
    A comment starting `@claude analyze` from an OWNER, MEMBER or COLLABORATOR
    on an issue (open or closed, never a PR) now runs it as
    `maintainer_request`, mirroring `@claude review` on PRs. In that mode the
    analyst re-checks its earlier analysis against the current checkout, treats
    text after the command as a steer on what to investigate (never as a
    change to its rules), posts a complete standalone analysis that says what
    changed, does not tag the maintainer, and leaves the issue's open/closed
    state alone. The reporter path is unchanged and still skips @claude
    comments, so one comment never starts both.
    
    No test reaches a workflow trigger; actionlint 1.7.7 passes on the file,
    and the first `@claude analyze` after the push is the demonstration.
  • fix(ci): make the issue analyst map the bug class before suggesting a fix
    The analysis of the node inbound rebuild traced the reported path
    correctly but stopped there: the same sink (the node's Del+Add on
    UpdateInbound) was also reached by auto-renew, traffic reset, delete
    depleted, the reconcile after a master restart and bulk ops past their
    threshold, and its suggested per-client push ignored the 32-push cap the
    codebase already enforces. A maintainer following it would have fixed one
    caller and left the rest dropping connections.
    
    Step 4 now asks the analyst to name the broken invariant, find the sink
    and grep every other path into it; a new `Same class:` field carries what
    it found; `Suggested fix:` must target the layer that closes all of them
    and be checked against existing caps, batch endpoints and mixed-version
    peers. `Not determined:` is no longer for a file the analyst did not open.
    
    No test reaches a prompt; the YAML still parses (checked with the
    frontend's yaml package) and the next analyst run is the demonstration.
  • fix(node): apply a pushed inbound's client changes in place instead of rebuilding it
    A master pushes the whole inbound to its node whenever a client on it is
    auto-disabled, renewed or reset, and the node-sync reconcile re-sends every
    inbound whose payload changed (all of them after a master restart). The
    node's UpdateInbound answered every push with DelInbound + AddInbound, so
    Xray closed the listener and every open connection on that port dropped.
    On a node inbound with ~2,700 clients that was dozens of times a day.
    
    UpdateInbound now diffs the config Xray is running against the new one.
    When only settings.clients differ (vless, vmess, trojan, hysteria, masque)
    it applies per-user RemoveUser/AddUser through the runtime, and when
    nothing the core sees changed it does nothing. Any other change, or any
    per-user failure (a handler the core lost included), still rebuilds as
    before. AmneziaWG joins MTProto and TUIC on rt.UpdateInbound, whose
    in-place Ensure keeps the device and its peers; Del+Add tore it down.
    
    A pushed removal does not consult the node's own
    restartXrayOnClientDisable: it defaults to on, and the master already
    restarts its nodes from its own setting (restartRemoteNodesOnDisable).
    Nodes on an older release keep rebuilding until they update; the master
    side needs no change.
    
    Verified: the new service tests, TestXrayAPI_E2E_Users against a real
    core (pins the missing-user vs missing-handler error texts) and make
    node-e2e. make race not run: no goroutine, lock or shared state changed.
    
    Closes #6795
  • fix(ci): drop id-token from the Claude workflows and tighten the review comment
    CodeQL alert #121 flags the pr-head checkout in the PR review job. The
    checkout is deliberate and nothing in the job executes it, but the job still
    carried `id-token: write`, and so did the issue analyst. claude-code-action
    only uses OIDC to trade for a Claude GitHub App token when no github_token is
    passed - that app token asks for contents, pull_requests and issues write -
    or for workload identity, which neither workflow uses. Both pass
    github_token, so the permission did nothing for them, yet any code running
    in either job could have minted that write token, undoing the review's
    read-only split.
    
    Three reviews posted on one morning (#6666, #6675, #6752) also showed rubric
    gaps. REVIEW.md said both "open with the verdict" and "lead with No blocking
    issues", so the comments opened three ways and two tallies dropped
    severities; the opening is now a fixed order - tag line only when blocking,
    verdict paragraph, one status line whose tally names all three severities.
    #6675 filed a spoofable X-Forwarded-For IP, which that PR first shows to an
    admin approving a login, under Design; Design now holds approaches and
    trade-offs only, and a concrete consequence the change makes reachable or
    worse is a finding. The coverage list ran to some 25 nested lines on #6752;
    it is now ten lines at most, one per area, no nested bullets.
  • fix(ci): let the PR review save its body, and scope the write-check bypass
    Run 38187893539 reviewed PR #6784 in full but posted nothing: the model's
    Write to /tmp/review.md was refused. Claude Code checks file permissions
    against Edit(path) rules only and never consults a Write(path) rule, so the
    allow rule was dead - and so were the Write(//home/**) and Write(//opt/**)
    deny rules meant to keep $GITHUB_ENV out of reach. All three are Edit rules
    now; a local headless run confirms Write(path) is refused, Edit(path) lets
    the file through, and an Edit deny still blocks a Write under it.
    
    allowed_non_write_users="*" skipped the action's write-permission check for
    every actor and warned each run. Only a pull_request_target from a fork
    needs it; an `@claude review` requester is already OWNER/MEMBER/COLLABORATOR
    and passes the action's own check.
  • feat(ci): make the PR review judge the claim and never post code
    The review only hunted defects: a correct fix got no word on whether the
    reported problem was real or actually solved, and a feature got no design
    feedback. The comment now opens with a verdict for every kind of change -
    for a fix, whether the failure exists on base, whether the head removes its
    root cause (checked against the issue-analyst's analysis) and whether the
    test proves it; for a feature, whether it overlaps what the panel already
    has, which deployment shapes it misses, and a prose-only Design section;
    for refactor, perf, dependency bumps, docs and CI, a question of their own.
    The trace scales to the change, so a typo is not traced like a runtime
    change. It also searches for duplicate merged or in-flight work, and runs at
    high effort since settling whether a bug is real takes tracing base and head.
    
    No code may appear anywhere in the comment, and the model no longer holds a
    write token. The workflow is three jobs: `prepare` (ack, pin the head, skip a
    reviewed PR), `review` (read-only token; the model writes /tmp/review.md) and
    `post` (no model, no checkout), which strips any fenced block, keeps the
    Reviewed head marker the skip relies on, and only then posts one plain
    comment. Before, `gh api` with a pull-requests: write token could touch any
    PR in the repository, `sed -i` could write $GITHUB_ENV, and the inline-comment
    tool told the model to use suggestion blocks. Concurrency stays on the review
    job: at workflow level any unrelated comment on the PR would replace a
    pending review in the queue.
    
    Restores three guards the earlier claude-bot review had: all author-controlled
    input, including text inside the checked-out code, is data and a diff adding
    text aimed at a reviewer or bot is a HIGH finding; a blocking finding tags the
    repository owner; and a diff too large to read whole has a reading order and
    must name what went unread.
  • chore(frontend): update dependencies
    Refresh frontend runtime and development dependencies, including Vite, Playwright, TanStack Query, and form and i18n packages.
  • style(sub): match the subscription page to the panel theme
    The sub page ran its own violet/cyan palette, an animated aurora
    backdrop, a grid overlay and a glass card, so it looked unrelated to
    every other panel page. It now uses the panel shell background and card
    colors for light, dark and ultra-dark, the panel's antd theme (blue
    primary) unmodified, and antd tokens for dividers, tiles and rows.
  • fix(xray): keep XDRIVE storage and Vision flow within what xray-core runs
    xray-core opens an XDRIVE stream's storage only when the inbound starts
    listening, so a Google Drive inbound saved with the form's defaults (no
    folder, no secrets), a local one without a folder, or a template one
    whose template xray cannot use stopped xray and every other inbound with
    it. validateXDriveStorage applies the core's storage rules at save, on
    inbound add/update and on the xray template's inbounds and outbounds:
    the service must be local, Google Drive or template; local and Google
    Drive need a remoteFolder; Google Drive needs its three non-empty
    secrets; a template must pass newTemplateStorage's checks (put, get,
    list and delete urls, and a list namesRegex with one capture group).
    
    A VLESS client kept its xtls-rprx-vision flow when its inbound moved to
    a transport that cannot carry it, and GetXrayConfig only honoured
    DisableFlow, so the server demanded Vision there and refused every
    client. GetXrayConfig and the outbound form now apply the Vision gate,
    and that gate now follows the core in the backend, the subscription
    service and the frontend: TLS/REALITY on raw TCP, or VLESS encryption on
    any transport (xray runs Vision inside encryption.CommonConn whatever
    the transport, not only on XHTTP). The outbound modal passes the VLESS
    encryption into the gate and gates Mux on the effective flow.
  • docs(security): name an email security contact
    GitHub private reporting stays the primary channel. The address gives
    reporters without GitHub a private route and matches the primary_contact
    used for the OSS Scanner enrolment, which checks SECURITY.md for it.
  • chore(security): add OSS Scanner build image and threat model
    Anthropic's OSS Scanner builds .oss-scanner/Dockerfile from this repository
    and audits the image offline. The image keeps the source, the Go module and
    npm caches, the debug panel binary, Xray-core and the sidecars, so tests,
    the xray gRPC e2e suite, the master+node e2e and a live panel all run with
    the network disabled. threat_model.md lists the trust boundaries, entry
    points and the severity rubric the scanner should report against.
  • fix(service): keep chunk capacity math from overflowing
    chunkStrings/chunkInts sized their result with (len+size-1)/size, so a
    size near MaxInt wrapped negative and make panicked with "cap out of
    range"; count the chunks with div+remainder instead. NormalizeUDPHop's
    len-hops+1 is bounded by len(masks) since hops >= 1, so cap at that.
    
    Resolves CodeQL go/allocation-size-overflow alerts #119 and #120.
  • fix(node-sync): keep shared-email lookups on the open transaction
    emailUsedByOtherInbounds and emailsUsedByOtherInbounds always queried
    through database.GetDB(), yet five callers run them inside a transaction:
    both node traffic sync sweeps (setRemoteTrafficLocked), the inbound edit
    stats sync (updateClientTraffics) and both email-drop branches of
    UpdateInboundClient. Each call needed a second pool connection while the
    transaction held row locks on client_traffics/node_client_traffics. On
    PostgreSQL, once subscription fetches (UPDATE client_traffics SET
    last_sub_fetch) blocked on those locks filled the rest of the 25-connection
    pool, the lookup waited forever, the transaction never ended, and the panel
    hung until restart.
    
    Both helpers now take the *gorm.DB to query on; transactional callers pass
    tx and the rest pass the pool handle they already hold. The new tests cap
    the pool at one connection, so any query that escapes the transaction
    blocks; each went red before the fix on SQLite and (node sync) on a live
    PostgreSQL 16, and passes after.
    
    Closes #6789
  • refactor(inbounds): drop the single-user shadowsocks inbound paths
    isSSMultiUser treated 2022-blake3-chacha20-poly1305 as a single-user
    inbound, and the inbounds page grew a row QR modal, a separate link
    panel in the info modal and a client-count skip for that case. The
    method is no longer allowed on inbounds, so every shadowsocks inbound
    carries clients and those paths cannot be reached: remove them along
    with the inbound-level QrCodeModal they alone opened.
  • fix(inbounds): refuse 2022-blake3-chacha20-poly1305 on shadowsocks inbounds
    xray-core builds a Shadowsocks-2022 inbound with users only for the AES
    methods: the multi-user identity header is AES-only, so the config
    builder and the multi-user server both reject chacha20. Every panel
    inbound carries clients, so picking 2022-blake3-chacha20-poly1305 in the
    inbound form kept the whole core from starting; its links also failed
    on the client with "multi-key is not supported".
    
    The inbound form no longer offers the method and AddInbound/UpdateInbound
    reject it. Startup moves stored inbounds to 2022-blake3-aes-256-gcm,
    which takes the same 32-byte keys, so every stored key stays valid.
    Outbounds keep the method, since a single-key outbound to such a server
    works. The share-link generator drops the single-user branch that only
    this method reached.
  • fix(inbounds): refuse a Shadowsocks-2022 server key xray-core cannot parse
    xray-core parses the inbound-level Shadowsocks-2022 key with ParseKey and
    refuses one of the wrong size while building the inbound, which keeps the
    whole core from starting, not only that inbound. Only client keys were
    checked, so an API caller posting a 32-byte key on aes-128 (or keeping a
    16-byte key after switching to aes-256/chacha20) saved fine and took
    Xray down.
    
    AddInbound and UpdateInbound now reject such a key with a message that
    names the method and the size it needs. The check uses the core's own
    GetCipherMethod/ParseKey, so a raw non-base64 key the core accepts stays
    valid. Startup also replaces a stored wrong-size server key: that inbound
    never worked, so no client holds a working copy of it.
  • fix(settings): accept five-field crontab for report and LDAP schedules
    The panel scheduler runs WithSeconds(), whose parser rejects a standard
    five-field crontab such as "30 8 * * *". An admin who typed one into the
    Telegram/Discord notify time or the LDAP sync schedule saved it without
    error, AddJob then failed at startup, and the job silently never ran.
    
    Admin-typed schedules now go through internal/util/cronspec, which takes
    an optional seconds column plus the @descriptors and hands the scheduler
    a parsed cron.Schedule. CheckValid rejects an unparseable schedule on
    save, and a stored legacy value falls back to the job's default instead
    of dropping the job.
  • fix(finalmask): refuse a salamander password xray-core cannot open
    xray-core needs a salamander (and gecko) password of at least 4 bytes
    (smPSKMinLen), but checks it only when a socket opens: xray run -test
    reports Configuration OK. On an inbound the listener then fails and Xray
    does not start at all, taking every other inbound down; on a client the
    dial fails. The panel saved any password, and the finalmask editor
    starts a new salamander mask with an empty one.
    
    maskcompat.CheckSalamanderPasswords applies the core's byte rule, pinned
    against the core's own ListenPacket, and every path that stores a
    finalmask refuses a short password: inbound add and update, hosts, the
    subscription's global finalmask, and the inbounds and outbounds of the
    Xray template. The editor flags it inline as it is typed.
  • fix(finalmask): keep a single udphop mask last in every client finalmask
    xray-core reverses finalmask.udp and refuses, at dial time, a mask that
    dials its own socket (udphop) anywhere but the socket end: "incorrect
    index". xray run -test still says Configuration OK, so the failure only
    shows as a client that never connects.
    
    UDPHopClientMaskFix turned a global subJsonFinalMask hop and a host hop
    into udphop masks; the JSON subscription then appended both, leaving two
    hoppers with the first one misplaced, and a host mask merged after a
    global hop pushed it off the end too. A hand-ordered template outbound
    or an imported fm= could carry the same order.
    
    maskcompat.NormalizeUDPHop keeps the last-listed udphop alone at the end
    of udp, and runs wherever a client finalmask is produced: each JSON
    subscription endpoint, share-link fm=, the Go and frontend link
    importers and the template outbound heal in GetXrayConfig. The JSON
    subscription resolves competing hop ranges most specific first: a host
    hop wins over the inbound's own, which wins over the global default.
  • style: trim MASQUE and XDRIVE comment blocks to two lines
    The MASQUE and XDRIVE commits left four comment blocks over the
    two-line cap CLAUDE.md sets for committed Go/TS.
  • fix(clients): refuse a ":" email on a MASQUE inbound
    MASQUE logs a user in with the email as the Basic-auth user name, so
    xray-core refuses the whole inbound (MASQUE: invalid "email") over one
    email holding ":", and with it the Xray start. The panel accepts such an
    email for every other protocol, so attaching or creating that client on
    a MASQUE inbound took every inbound down on the next restart.
    
    syncInboundClients is the write every create, attach, bulk, import and
    inbound-edit path shares inside its transaction, before the runtime
    push, so the per-protocol check there now refuses the email for MASQUE
    next to the existing TUIC identity check, loading the protocol once.
  • fix(sub): keep the udphop mask on every JSON-subscription endpoint
    UpgradeLegacyUDPHop deleted udpHop from the quicParams map it was handed
    in place. The JSON subscription runs it once per endpoint on a finalmask
    that mergeFinalMask (host masks) or withLegacyFragmentRanges cloned only
    shallowly, so the first endpoint emptied the inbound's shared quicParams
    and every later endpoint got {"quicParams":{}} and no udphop mask: a
    hysteria inbound with port hopping and two hosts hopped on the first
    host's config only.
    
    The upgrade now replaces quicParams and udp on the finalmask it is given
    instead of writing into values a merged finalmask shares, as the
    frontend's upgradeLegacyUdpHop already does.
  • feat(outbounds): TLS for XDRIVE outbounds
    xray-core 26.10.10 dials an XDRIVE outbound's storage API with the
    stream's tlsSettings: their SNI, uTLS fingerprint and ALPN are what the
    API sees, which is the point of fronting it. canEnableTls kept XDRIVE out
    of the TLS-capable networks, so the security picker never offered TLS and
    switching a TLS outbound to XDRIVE silently reset it to none.
    
    canEnableOutboundTls admits a TLS-eligible protocol on xdrive and backs
    both the picker and the network-change cascade. Inbounds keep the plain
    predicate: their tlsSettings carry server certificates, not a client hello.
    
    Also restores the plain oxfmt / oxlint --fix lint-staged commands, reverting
    da6872a3: that hook change was not wanted.
  • feat(inbounds): TUN adapter type and auto-system options
    xray-core 26.9 added three TUN settings the inbound form could not set:
    
    - desc, the tunnel type a new Wintun adapter is created with on Windows.
      The settings schema did not list it, so the parse stripped it and a
      value entered as JSON vanished on the next save;
    - autoSystemDnsToGateway (Linux), which points systemd-resolved at the
      TUN gateway;
    - autoSystemWfpBlockLeak (Windows), whose dns / misconfigtun filters keep
      traffic from leaking past the TUN.
    
    The tooltips name the platform each one acts on and what it needs, since
    the core refuses to build or start the TUN otherwise.
  • feat(xray): edit Lua DNS and routing scripts
    xray-core 26.10.10 can hand DNS and routing to Lua: dns.script and
    routing.script name a .lua file (absolute, or found next to the Xray
    binary) that defines HandleDNSQuery / HandleRoute, and a DNS server's id
    is how a DNS script picks it. The keys round-tripped through the JSON
    template but had no field.
    
    - DNS: a Lua Script field, and an ID field in the server modal;
    - Basics: a Routing Script field beside the routing strategy;
    - Routing: a warning above the rules while a script is set, since the
      core then routes only through the script and skips every rule, the
      panel's api rule included.
    
    The descriptions say the script must still send the api inbound to the
    api outbound, and that Xray will not start if the file is missing. An
    empty field drops the key, because the core rejects an empty path.
  • feat(finalmask): header-custom variables, sudoku UDP mask and noise reset ranges
    xray-core 26.6 grew the finalmask surface the editor could not express,
    and the finalmask watch drops any key without a registered field, so a
    config written by hand lost these keys on the next save:
    
    - header-custom items can capture their bytes into a variable, reuse one
      or emit a transform expression; a Kind select keeps each item to exactly
      one kind, as the core requires, and only parsed JSON reaches transform;
    - TCP header-custom gains the errors group (the reply sent when a client
      group does not match), UDP header-custom its prefix/standalone mode;
    - sudoku is offered as a UDP mask, and share links keep it in fm=;
    - the noise reset is an Int32Range, so it now takes "60-120" as well.
    
    The new golden fixture is saved unchanged by the outbound editor and
    built by xray-core in TestGoldenStreamFixturesBuildInXray.
  • fix(finalmask): hop client UDP through the udphop mask
    xray-core 26.9.9 dropped finalmask.quicParams.udpHop for the client-only
    "udphop" UDP mask {mode, interval, remoteIPs, remotePorts}. The panel kept
    writing the old key, so hysteria/xhttp outbounds and JSON-subscription
    clients silently stopped hopping ports.
    
    An inbound keeps quicParams.udpHop: it is panel metadata advertised as the
    link's mport, and a udphop mask on a listener fails with "udphop: client
    only". The conversion (maskcompat.UpgradeLegacyUDPHop, intervalRemote mode)
    runs only where a client config is produced:
    
    - UDPHopClientMaskFix seeder over hosts, sub-JSON finalmask, cached
      outbound-subscription outbounds and template outbounds (never inbounds);
    - GetXrayConfig heals template outbounds at build time;
    - the JSON subscription upgrades each generated client stream;
    - the Go and frontend link importers upgrade a legacy fm= param.
    
    The finalmask editor gains a side prop: the client side lifts the dead key
    on mount and offers a udphop mask editor (also for xhttp's HTTP/3 dial);
    the inbound side keeps the UDP Hop switch, labelled as advertised.
  • fix(inbounds): accept masque in the inbound protocol validator
    The inbound add and update handlers bind the body into model.Inbound and
    validate Protocol against a oneof list that predates MASQUE, so every
    save of a MASQUE inbound from the panel or the API failed validation
    even though the rest of the stack (b04039c2) handles the protocol.
    Add masque to the list and regenerate the schemas and OpenAPI document
    that mirror it.
  • chore(frontend): let lint-staged pass commits that stage only generated files
    lint-staged hands every staged src/**/*.ts file to oxfmt and oxlint, but
    both ignore src/generated, so a commit whose only TypeScript change is a
    regenerated schema (a validator tag edit plus make gen) aborts with
    "Expected at least one target file". Tell both tools an empty selection
    is not an error.
  • feat(warp): register WARP over MASQUE from the WARP modal
    xray-core's masque transport reaches Cloudflare WARP with an enrolled
    ECDSA P-256 key, the endpoint's public key and the assigned tunnel
    addresses, which only a WARP enrollment hands out.
    
    A new regMasque action on /panel/api/xray/warp/:action registers a
    separate WARP device and enrolls a secp256r1 key for the masque tunnel
    (the API revision and client version the WARP apps enroll MASQUE keys
    with). Enrolling replaces a device's WireGuard key, so it never touches
    the stored WireGuard registration. It returns the PEM key pair, the
    addresses and the endpoint, and the WARP modal turns them into a
    warp-masque outbound (HTTP/3, Cloudflare's MASQUE SNI), or refreshes
    the one already there.
  • feat(xray): add the MASQUE protocol and transport
    xray-core v26.10.10 serves MASQUE: CONNECT-IP over HTTP/3 or HTTP/2,
    always behind TLS, as an inbound and an outbound protocol riding a
    dedicated "masque" transport. The panel could not create either.
    
    Inbound: MASQUE is a multi-user protocol whose users log in with their
    email and password over Basic auth. The panel keeps the client's
    "password" like trojan and GenXrayInboundConfig hands it to the core as
    "pass", so the full-config path, the live AddInbound path and node
    pushes all emit what the core reads; one user with an empty pass makes
    the core refuse the whole inbound. Live user adds build a masque.Account
    from either key, client-only changes diff per user so a new client does
    not drop every connected tunnel, and client creation, copy, validation
    and edits key on the password. The address pool and MTU get form
    fields, TLS is mandatory, and the port check follows the core's
    listener choice: HTTP/2 on TCP when the ALPN offers h2, HTTP/3 on UDP
    when it offers h3 or not h2. Nodes may host MASQUE from v3.9.1, the
    first panel release that knows to rename the password.
    
    MASQUE has no share-link format, so links and Clash skip it; the JSON
    subscription builds the client's masque outbound with its email and
    password, and the subscription allowlist now lets a subId see MASQUE
    inbounds at all. The IP-limit job, client pages and traffic tracking
    list the protocol.
    
    Outbound: the form edits the server, remote DNS, and the transport's
    host, path, Basic credentials, headers and WARP block (enrolled key,
    endpoint public key, tunnel addresses), which xray-core refuses next to
    user/pass. The outbound test probes it through the core, since its
    default HTTP/3 dial is UDP.
  • feat(xray): add the XDRIVE transport
    xray-core v26.10.10 tunnels a stream through files in shared cloud
    storage ("network": "xdrive"): Google Drive, a local folder, or any HTTP
    storage API described by a template. The panel could not select it, and
    the stream schema rejected a pasted xdrive stream outright.
    
    The inbound and outbound forms now offer XDRIVE with one shared editor:
    service, folder, the three Google Drive secrets in the order the core
    reads them, a template JSON editor with its {secretN} values, the
    optional domain front (the stream-level address/port the storage client
    dials), and the core's tuning knobs with their defaults as placeholders.
    Switching an inbound to XDRIVE resets security to none, because the
    core would otherwise read the inbound's TLS/REALITY as the storage API's
    client TLS.
    
    XDRIVE has no share-link format, and a link carrying the storage
    secrets would print them into every QR code, so both link generators
    emit none for it; the JSON subscription already passes the stream
    through intact, and Clash drops the unknown transport.
  • feat(xray): update xray-core to v26.10.10 and adapt panel
    Move the three Xray binary pins (DockerInit.sh, both release.yml
    fetches) to v26.10.10, in lockstep with the xtls/xray-core module that
    82c77111 already bumped to 701af60772cd.
    
    xdns finalmask (#7090): a domain now takes a "names" list instead of a
    single "name", and a resolver is an "addrs" list of udp:// or tcp://
    URLs instead of {type, settings:{addr}}. The loader ignores the old
    keys rather than failing, so every mask the 26.9.30 seeder wrote would
    load with no domain and no resolver and the tunnel would carry nothing.
    maskcompat.UpgradeLegacyXdns now lifts both the pre-26.9.30 string lists
    and the 26.9.30 objects straight to names/addrs, dropping entries the
    old loader refused. A new seeder (XdnsFinalmaskNamesAddrsFix) reruns it
    over every stored finalmask, and the save path, GetXrayConfig, both
    link importers and the mask editor's mount lift go through it. Template
    outbounds now get the build-time heal too: a 26.9.30 template pasted
    after the seeder passes the save check, since the core loads that shape
    without error. The editor edits names and addrs as tag lists and no
    longer requires record types, which the core now defaults (TXT on a
    client, A/CNAME/TXT/AAAA on a server). The wire format did not change,
    but clients on an older core cannot read the new config shape.
    
    Lua scripts (#6823): dns.script, routing.script and dns servers[].id
    are new. The xray page parsed the dns block with a strict schema, so
    loading it dropped script and id and the next save deleted them; the
    schema now keeps both and the DNS server modal carries the id through
    an edit. The hot routing apply built routing in-process, and that build
    now resolves the script file from the panel's working directory, so a
    script beside the xray binary failed every rule change into a full
    restart and broke the node bridge. RoutingService cannot change the
    script anyway, so the panel no longer resolves it there.
    
    TLS client roots (#7105): the core now verifies against its bundled
    Mozilla roots instead of the OS store unless tlsSettings.useSystemCA is
    set. The outbound TLS form gets a switch for it, so an outbound to a
    server signed by a privately installed CA can opt back in.
  • chore(deps): update Go and dependencies
    Raise the Go version to 1.27.2 and refresh Xray, LDAP, and related dependencies.
  • fix(update): leave TLS alone during panel updates
    The panel's web Update runs update.sh with stdin on /dev/null. On a panel
    with no certificate configured, config_after_update opened the SSL menu:
    read got EOF, the empty answer selected "Let's Encrypt for IP", x-ui was
    stopped and IP-certificate issuance ran, and its failure path rm -rf'd
    /root/cert/ip and the acme.sh state, deleting a pair other services may
    share. The URL printed afterwards was always https:// even when nothing
    was configured. When the public-IP lookup failed, the same run instead
    looped forever on an "enter your server IP" prompt it could never answer.
    
    An update now only updates the panel: the SSL setup path and the helpers
    only it used are removed from update.sh, the IP lookup falls back without
    prompting (it is only used for the printed URL), and the URL reports the
    scheme the panel actually serves. TLS stays configurable from the x-ui
    menu and install.sh.
    
    Supersedes #6667.
  • feat(install): install PostgreSQL 18 from PGDG for new local databases
    The local PostgreSQL setup installed whatever the distro metapackage pointed
    at, so Ubuntu 22.04 got 14 (EOL Nov 2026), Debian 12 got 15 and EL9 got 13.
    Servers ended up on different majors, and a pg_dump backup taken on a newer
    server does not restore onto an older one.
    
    New installs now add the official PGDG repository and install
    PostgreSQL 18 (apt on Debian/Ubuntu, dnf on EL 8+ with the AppStream module
    disabled, postgresql-18 service and /var/lib/pgsql/18/data). Where PGDG has
    no build (Ubuntu 20.04, Debian 11, armhf/i386/s390x, EL7, Fedora, Amazon
    Linux, older EL point releases) the repository change is rolled back and
    the distro package is installed as before. A host that already has a
    cluster keeps it, so existing installs are never upgraded.
    
    x-ui.sh resolves the postgresql-18 unit on EL for start/stop/log and also
    removes the PGDG packages on purge.
    
    Verified in containers: Ubuntu 22.04/24.04, Debian 12, Rocky 8/9 and
    AlmaLinux 10 get 18.6; Ubuntu 20.04 falls back to 12 and Debian 12 armv7 to
    15 with apt-get update still clean; Ubuntu 22.04 with an existing 14 cluster
    stays on 14. The CI PostgreSQL test set passes against postgres:18.
  • fix(node): keep client traffic history when a node inbound is replaced
    When a node snapshot reports an inbound under a tag that matches neither
    the central tag nor an origin/port alias, SetRemoteTraffic adopts it as a
    new central inbound and, in the same tick, sweeps the old one. The sweep
    deleted the old inbound's client_traffics rows even though the snapshot
    still reported those emails under the new inbound. existingEmails was
    computed before the sweep, so the rows were not recreated that tick; on
    the next tick the inbound was no longer new, the rows came back seeded at
    0/0 and the node baseline jumped to the node's totals. Quota accounting
    lost every byte the clients had used.
    
    The sweep now moves rows for emails the snapshot still reports to the
    inbound now carrying them, instead of deleting them. Only emails the node
    no longer reports at all lose their row, mirroring the existing baseline
    rule.
    
    The alias check also treated a master-created node inbound that had not
    been tag-matched yet (empty origin_node_guid) as foreign, so a renamed tag
    on its first sync replaced it instead of aliasing it. An empty origin now
    counts as this node.
    
    PostgreSQL lane not run locally; the change is a plain UPDATE through GORM.
    
    Closes #6749
  • chore(deps): bump frontend and docs deps, clear npm audit findings
    Bump vite, oxlint/oxfmt, msw, jsdom and plugin-react in the frontend, and
    fumadocs, lucide-react, oxlint/oxfmt, postcss and pnpm in docs.
    
    npm audit reported seroval <=1.6.2 (critical) via solid-js, which the
    react-query devtools pull in pinned to ~1.5.4, and sprintf-js (no patched
    release) via remarkable's argparse@1. `npm audit fix --force` "fixed" both
    by downgrading swagger-ui-react to 3.23.3, which brings in far worse
    advisories. Instead override seroval/seroval-plugins to ^1.6.8 and give
    remarkable argparse@2; remarkable only requires argparse from its unused
    CLI entry, so the bundled library is unaffected.
    
    pnpm appends an exact-version minimumReleaseAgeExclude entry on every
    update of a too-fresh release and never prunes them. Drop the stale ones;
    keep only fumadocs 16.16.2 and oxlint/oxfmt, still inside the 1-day cutoff.
  • fix(sub): emit host TLS verification at xray level in JSON subscription
    The JSON subscription flattens tlsSettings into xray's client shape before
    the per-host loop, then applyExternalProxyTLSToStream writes the host's
    echConfigList, verifyPeerCertByName, pinnedPeerCertSha256 and
    allowInsecure into the panel-only tlsSettings.settings map. Xray ignores
    that map, so a host's ECH (and its pins / verify name) never reached the
    client and connections through the host failed.
    
    After the host overrides are applied, lift that map through the same
    writer tlsData uses for the inbound's own TLS: fields land at the top of
    tlsSettings, pins are joined into the comma string xray parses, and
    allowInsecure is dropped exactly as it is for the inbound (removed from
    xray). The Clash renderer still reads the nested map and is unchanged.
    
    The helper-level subtest that pinned the nested location as the "json"
    shape is replaced by an end-to-end GetJson test on a host-backed inbound.
    
    Closes #6743
  • fix(node): ignore a node's stats for clients detached from the inbound
    Invariant: a node snapshot may move a master client's traffic state only
    for emails the reporting inbound's settings still list.
    
    A master detach calls the node's /detach endpoint, which keeps the stat
    row (keepTraffic), and the node's GetInbounds preloads ClientStats by
    inbound_id alone, so the node goes on reporting the detached email under
    that inbound. setRemoteTrafficLocked merged every reported entry: it
    copied the node's stale total onto the master's per-email row, after
    which the matching limits made the node's enable=false look genuine and
    latched the client disabled on the master. A master quota edit only
    reaches inbounds the client is attached to, so the next sync (every 5s)
    wrote the stale quota back.
    
    The same unchecked loop also created a fresh client_traffics row for a
    reported email the master no longer had once its tombstone expired.
    
    Snapshot entries are now gated on the inbound's settings.clients. When
    the settings cannot be parsed, membership is unknown and every entry is
    merged as before.
    
    Closes #6724
  • fix(frontend): wrap overview modal action buttons on long labels
    The Geodata Auto-Update actions row is a non-wrapping flex row with no
    gap. Its three buttons fit in English, but the longer Russian, Ukrainian
    and Turkish labels make the row wider than the default-width modal, so
    the buttons spill out of it. The row now wraps with an 8px gap.
    
    .actions-row is a global class defined identically in VersionModal.css
    and PanelUpdateModal.css, so both copies change to keep the cascade
    order irrelevant. Verified in Chromium with a temporary Storybook story
    rendering VersionModal in ru-RU: the first button sat 88px outside the
    modal before the change and inside it after.
    
    Closes #6737
  • fix(qr): hide the QR only for links carrying post-quantum keys
    A share link's QR is suppressed only when it carries a post-quantum key
    payload too large to scan: an ML-DSA-65 verify key (pqv) or an ML-KEM-768
    VLESS-encryption auth key. isPostQuantumLink substring-matched "mlkem768"
    anywhere in the URL, so it misfired on:
    
    - every VLESS/Trojan REALITY link, since ce221c33 added the
      support-x25519mlkem768=true hint (235 chars, QR version 10);
    - every VLESS-encryption link authenticated by an X25519 key, whose
      value always starts with mlkem768x25519plus (321 chars, version 11);
    - any remark or host containing mlkem768 / mldsa65 / ML-KEM-768.
    
    All four QR surfaces (inbound QR, client QR, client info, public sub
    page) lost their QR button for those links. The detector now reads the
    query: a non-empty pqv, or an encryption whose auth key
    vlessEncryptionAuthKind classifies as ML-KEM-768.
    
    Closes #6730
  • fix(frontend): show toasts through message.useMessage, never the static API
    Invariant: an antd toast lives inside the React tree of the component that
    raised it, so it takes the theme from ConfigProvider and unmounts with it.
    
    Four components called antd's static message.* (Happ settings, TUIC form,
    routing tab, command palette); the other 40 use message.useMessage. A static
    toast renders in a detached root that RTL's cleanup never unmounts, so its
    rAF-driven close timer kept updating state for ~3s after a test file ended.
    happ-routing-editor.test.tsx logged 419 act() warnings, 226 of them after
    its last test; on a slow runner the worker closed first and vitest failed
    the job with "Closing rpc while onUserConsoleLog was pending" (CI runs
    37075337071, 37303631843). In the product the same toasts ignored the
    dark/ultra theme.
    
    The command palette keeps its holder mounted while closed: restartXray
    closes the palette before its success toast. The Happ editor test now
    asserts its toast unmounts with the component (red on the static API), and
    no-static-message.test.ts fails on any static call in src. The spy that
    silenced message.success in happ-settings-presets.test.tsx intercepted
    nothing after the change and is gone.
  • fix(api-token): let a node-sync master reach every node endpoint it calls
    Invariant: every request runtime.Remote sends to a node is accepted under
    the node-sync scope, except /server/updatePanel, which #6201 withholds on
    purpose.
    
    The allowlist was written on 2026-08-15 and three Remote calls arrived
    after it without being added: /clients/activeInbounds (#6164, same day),
    /inbounds/:id/subSortIndex (#6179) and /clients/bulkResetTraffic
    (4210a50c). A master enrolled with a node-sync token or mTLS got 403 on
    each: the subscription sort order and multi-client traffic resets never
    reached the node, and online attribution silently fell back to email-only
    because FetchTrafficSnapshot logs that failure at debug level.
    
    TestMasterNodeContract drives every exported Remote method through the
    production router, once per enrollment scope, fails on any 401/403 the
    node returns even when Remote swallows it, and fails when a Remote method
    has no cell. It replaces TestNodeSyncScopeAllowlistMatchesRemoteInventory,
    a hand-copied duplicate of the allowlist that never read Remote and so
    missed all three; its updatePanel rule stays in
    TestNodeSyncScopeUsesFullPathPatterns. It also supersedes
    TestMasterPushWithAdminTokenAppliesClients (its UpdateInbound cell); that
    file's removal landed in dae91276 by a staging slip.
  • chore(nodes): run the master+node scopes in parallel and document both layers
    Each enrollment scope owns its panels, ports and temp dirs, so the two run
    side by side; the only shared state, the process-global database handle the
    harness borrows for setup and for simulating a lost inbound, is now behind a
    mutex. On Linux the suite drops from 188s to 95s.
    
    CLAUDE.md now names the fast contract layer (node_contract_test.go, in
    make test-go) next to the multi-tick nodee2e layer.
  • chore(nodes): add a master+node end-to-end harness and CI job
    Node sync had no test with two real panels: the single-panel tests either
    call the node's controller in-process or hand-set the node-sync scope, so
    823db059 shipped a regression no test could see (an admin-token node
    dropped every client and enable flag its master pushed).
    
    internal/nodee2e starts a master and a node as separate panel processes
    (the DB is a process-wide global, so one process cannot be both) and walks
    17 operations per enrollment scope (admin token, node-sync token): adopt,
    create/edit on the master, small and bulk attach, client disable, detach,
    client delete, inbound disable, traffic pull and reset, node-side delete
    mirrored centrally (#6219), master-side delete, node down, node-lost
    inbound re-created, create/edit while down, node disabled on the master,
    and selected sync mode leaving unselected inbounds alone.
    
    Against the build before 2ffc694a it fails 6 cells for an admin-token node
    and 1 for a node-sync one; on main all 34 pass, on Windows and on Linux.
    `make node-e2e` builds a stub-dist binary and runs it; ci.yml runs it as
    its own job where a SKIP fails the build. Xray is not started, so cells
    assert the node's stored state, not traffic through the core.
  • fix(nodes): let a master's push and reconcile converge node inbounds
    Invariant: every inbound the master holds for a node, with its clients and
    enable flag, converges onto that node at the next push or reconcile.
    
    823db059 made an inbound save keep the stored clients and enable unless the
    request is a master push, recognised only by a node-sync token scope. Nodes
    are usually enrolled with an admin token (the -getApiToken and install
    default), so their nodes treated every master push as a stale form save:
    clients attached on the master (Attach existing clients, bulk attach above
    the per-client threshold, any dirty-node reconcile) never reached the node,
    yet the push was recorded as successful so reconcile stopped retrying.
    Remote now marks every request with X-3x-Master-Push, and the node honours
    it like the node-sync scope. The browser form never sends it, so the
    stale-form protection for panel saves and plain API scripts is unchanged.
    
    Separately, an inbound deleted on the node kept its tag->id in the
    master's cache, so reconcile sent update/<deleted id> forever instead of
    re-creating it. When the node reports no form of the tag, ReconcileInbound
    now drops the cached id so the resolve re-reads the node and falls back to
    add. Two runtime tests pinned the old update-to-cached-id path for an
    absent inbound; they now count the add, or report the inbound present.
  • fix(tuic): accept the server's STOP_SENDING when tests close uni streams
    The race job failed in TestAudit3ManagerEnsureActualSendersWithPersistentTraffic
    with "close called for canceled stream 14". The server parses one command
    per uni stream and then calls CancelRead, as the quinn reference server does
    on drop, so its STOP_SENDING can reach the client before the client's own
    Close and quic-go reports that Close as an error. The data was already read.
    
    Every test that wrote a command on a uni stream and required Close to
    succeed shared this race. closeUniStream accepts only a remote StreamError
    on the stream's context, so any other Close failure still fails the test.
  • fix(tuic): wait for both traffic counters in the relay E2E tests
    The race job failed on TestServerUDPDatagramE2E with Up:0 Down:1300.
    BytesUp is added on the sending goroutine after the relay Send returns,
    while BytesDown is added on the response goroutine, so the mock echo can
    be counted and delivered before the upload is. The test drained the
    counters once right after the reply and assumed both were present.
    
    Production is unaffected: deltas left for the next collection window are
    still summed. The TCP E2E test made the same assumption, so both now
    accumulate drained deltas until up and down reach the payload size.
  • fix(server): apply the outbound address policy to remote cert pinning
    The remote certificate fetch now dials through the same netsafe guard
    as the REALITY target scan. A private or loopback endpoint is refused
    unless the request carries allowPrivate; the inbound form asks the
    operator to confirm and retries with the opt-in.
  • fix(database): keep the dump restore inside its own database file
    A SQL dump replay only has to rebuild the tables of the database it
    restores into. Run it on a single connection whose attached-database
    limit is zero, so the script cannot open or create any other file.
  • fix(tgbot): resolve the panel egress bridge per connection
    The bot read the panel-egress bridge once at start, so when Xray came up
    after the bot (or Panel Outbound was set later) it kept dialing Telegram
    directly until restarted - on a filtered host it never connected.
    
    With no dedicated bot proxy, the fasthttp client now resolves the bridge on
    every new connection and falls back to a direct dial when it is absent.
    Raised in #6682.
  • feat(inbounds): deploy AmneziaWG, TUIC and MTProto inbounds to nodes
    The node gate assumed a node-assigned sidecar row would never converge,
    because the master's reconcile loops only read node_id IS NULL rows. But
    a pushed row is local on the node's own panel, whose AmneziaWG, TUIC and
    mtg loops run it like any other; node-adopted rows of these protocols
    already worked. Only creating or cloning them from the master was blocked.
    
    Open the three protocols on both lists and fix what assumed the master's
    host for a node row:
    - A node older than the release that introduced the protocol (MTProto
      v3.5.0, AmneziaWG v3.7.0, TUIC v3.8.0) would hand it to Xray as-is, so
      add and protocol-changing update refuse it, and a node that has not
      reported its version yet. Dev builds ("dev+<sha>") track main and pass.
    - MTProto's routeXrayPort is a loopback port on the host running mtg.
      The master no longer allocates one, nor forwards a cloned source's, for
      a node row; the node allocates its own and node sync adopts it back.
    - AmneziaWG forwardedPorts were checked against the master's inbounds,
      web port and id-derived relay ports. A node row is now checked against
      its own node's inbounds; the node re-checks what only it knows.
      UpdateInbound restores the stored nodeId before that check.
    
    Verified on a docker master+node pair: AWG, routed MTProto and TUIC
    created and cloned from the master start on the node (interface, mtg,
    tuic-server); an AWG client added and an MTProto client edited on the
    master apply on the node; the node-chosen egress port survives edits.
    
    Closes #6306
  • fix(docker): build the frontend stage on Node 26
    .nvmrc and frontend/package.json engines moved to Node 26 / npm 11 and the
    lockfile is now written by npm 11, but the Dockerfile's frontend stage stayed
    on node:22-alpine. npm 10 rejects that lockfile ("Missing: msw@2.15.0 from
    lock file"), so `npm ci` fails and the image no longer builds.
  • chore(amneziawgnet): bind test sockets to loopback
    Windows Firewall prompted on every run of amneziawgnet.test.exe, since
    the tests opened AmneziaWG, outbound-client and port-forward sockets on
    all interfaces and go test rebuilds the binary under a fresh temp path,
    so a granted exception never sticks.
    
    Route every "all interfaces" bind through wildcardBindHost, which is
    empty in production (behaviour unchanged) and pinned to 127.0.0.1 by
    the package TestMain.
  • refactor(util): move panel version comparison into a shared package
    The node-assignment path in the service package needs the same
    MAJOR.MINOR.PATCH comparison the panel updater uses, but service/panel
    imports service, so the helper cannot stay there.
  • feat(ci): let the review bot read the discussion, the issue and xray-core
    The bot never read the replies under its own findings, so a finding a
    maintainer had already declined came back on the next `@claude review`.
    It now reads every comment and inline thread first: a maintainer's answer
    settles a finding for good, anyone else's is a claim checked against the
    code, and the summary gives each earlier finding a disposition. It also
    reads the issue the PR claims to fix and reports a partial fix.
    
    REVIEW.md asks for an upstream symbol behind every wire-format claim, but
    the job had no xray-core source (#6718's review said so). The module the
    base go.mod pins is now unpacked into a hidden dir in the base workspace;
    nothing from pr-head runs.
    
    REVIEW.md gains the rules only /senior-review carried: keep read,
    reproduced and inferred claims apart, evidence for performance findings,
    a traced trust boundary for security ones, and duplicated logic as a
    finding. The summary now says each inline finding in one line.
  • fix(ci): stop the review bot naming where the fix belongs
    65b9bfed narrowed the fix carve-out to "one clause naming WHERE the fix
    belongs", but the bot still closes every finding with that clause, and set
    beside the defect it already named, the location is the fix. On #6718 it
    listed the two capabilities the bounding set lacks, then wrote "The fix
    belongs in the capability bounding set". Drop the carve-out from REVIEW.md
    and the workflow prompt: the finding's file:line already says where.
  • fix(maskcompat): size xdns domain list from domains alone
    CodeQL (go/allocation-size-overflow, alerts #115/#116) flagged the
    len(rawDomains)+len(rawResolvers) capacity hint. The sum cannot overflow
    in practice, but the hint bought nothing: resolver-derived domains are
    deduplicated and append grows the slice as needed.
  • chore(deps): update project dependencies
    Refresh Go, frontend, and documentation dependencies, including MSW 3 and pnpm 12.8.1. Update the MSW test setup to use the renamed `onUnhandledFrame` option.
  • feat(xray): update xray-core to v26.9.30 and adapt panel
    Bump xtls/xray-core to b26a91de4f (v26.9.30) and the three binary pins
    (DockerInit.sh, release.yml Linux + Windows) in lockstep. No deleted
    symbols; the sing and sing-shadowsocks indirect deps drop out with the
    SS2022 rewrite.
    
    XDNS finalmask (#6718) replaced its string lists with objects: domains
    are {name, types, edns0, lenLimit, labelLimit} and client resolvers
    {type, settings.addr}. The loader no longer parses the old lists, so a
    single stored xdns mask keeps the whole core from starting. The new leaf
    package internal/util/maskcompat converts them: "name[:type]" becomes a
    domain and "name[:type]+udp://addr" a domain plus a udp resolver. A bare
    name maps to TXT, the type legacy clients queried by default, and each
    converted domain keeps the 1232-byte EDNS0 the old code always used
    (without it the server caps answers at 512). It runs from:
    - the XdnsFinalmaskObjectsFix seeder, over inbound streams, hosts, the
      xray template, the global sub-JSON mask and cached subscription
      outbounds;
    - inbound save (normalizeStreamSettings) and GetXrayConfig, for rows
      that never went through the seeder;
    - both link importers, since fm= from an older panel carries the lists.
    The finalmask form edits the object shape (every key needs a registered
    field, or the finalmask watch drops it on save) and lifts legacy masks
    on open. The udp-mask golden fixture moves to the object shape, which
    TestGoldenStreamFixturesBuildInXray now builds through the core. The
    wire format changed as well, so pre-upgrade clients need the new core.
    
    WireGuard outbound (#6771) dropped settings.domainStrategy and the
    remoteDNS "local" mode. The endpoint lookup now follows
    sockopt.domainStrategy and in-tunnel targets the outbound's
    targetStrategy. The old key is silently ignored, which undid the
    IPv4-first endpoint lookup the WARP outbound depends on (#5205), and
    "local" now panics the core at startup because remoteDNS goes through
    netip.MustParseAddr. The WireguardDomainStrategyFix seeder moves a stored
    family preference to both keys (a value already set wins) and turns
    "local" into targetStrategy; the outbound form lifts legacy rows the same
    way and drops its select, the WARP modal writes the new placement, and
    the inbound form loses a field the server never read.
    ValidateOutboundConfig now refuses a non-IP remoteDNS entry, which
    conf.Build() lets through, on template save and for outbound
    subscriptions.
    
    Noise finalmask items accept type "exp" (#6862), a tag expression. The
    form offers it for noise items only: header-custom items go through the
    core's PraseByteSlice, which refuses it.
    
    TUN gained autoSystemDnsToGateway (Linux) and autoSystemWfpBlockLeak
    (Windows). Both pass through the settings schema so a value set in JSON
    survives the next form save.
    
    MASQUE (inbound, outbound, transport) and the XDRIVE transport are new
    protocols the panel does not offer yet; their new loader refusals only
    cover configs the panel never generates. The FakeDNS IPv6 pool default,
    the SS2022 rewrite (same gRPC account; emails are now deduped
    case-insensitively, as the panel already does), the restored udphop
    interval default and the rest change no panel-facing config.
  • fix(frontend): keep the given file name on mobile downloads
    FileManager typed every download text/plain. Android's MediaStore appends
    the MIME type's extension whenever the name's own extension maps elsewhere,
    so a subscriber saving a WireGuard config got peer.conf.txt, which the
    WireGuard app refuses; .json, .yaml and .log downloads were renamed the same
    way. Desktop browsers honour the download name, which is why only phones
    saw it. application/octet-stream carries no extension of its own, so the
    name the panel chose is kept.
  • fix(hosts): advertise Hosts in every WireGuard, AmneziaWG and TUIC config
    Invariant: an inbound's enabled Hosts are the endpoints every client config
    for it advertises, whichever surface renders that config.
    
    WireGuard and AmneziaWG broke it. Their raw generators ignored the
    externalProxy entries Hosts are injected as and always emitted
    resolveInboundAddress, so the raw subscription, the sub page .conf, the
    clients links API and "export all links" gave out the panel address while
    the JSON and Clash formats of the same inbound used the Host.
    advertisedEndpoints now states the fan-out once for mtproto, wireguard and
    amneziawg.
    
    The browser-built configs had the same gap. The Clients page WireGuard and
    AmneziaWG config blocks and QR panels, and its TUIC Clash config, used the
    panel hostname next to server links that already used Hosts; the Inbounds
    page peer configs, QR and export ignored them too. withMtprotoHostEndpoints
    becomes withHostEndpoints over a shared hostEndpointsFor mirror of the
    backend, the tunnel fan-outs render one config per Host, and the clients
    page waits for the hosts list the way the inbounds page does, so an empty
    list means "no hosts" rather than "not loaded yet".
  • docs(architecture): fix table padding flagged by oxfmt
    The NodePendingReset row added in 4210a50c had one extra space of padding,
    failing the Docs CI format check.
  • fix(inbounds): keep the stored client list and enable on inbound save
    Invariant: saving an inbound's configuration never changes which clients it
    holds nor whether it is enabled; both have their own endpoints. The edit
    modal posts back the clients and the enable flag it loaded when it opened.
    A client added meanwhile (another admin, the bot, the API, LDAP) was
    detached and its stats deleted; a client deleted meanwhile came back with
    its credentials, restoring access that had been revoked; an inbound
    switched off meanwhile was switched back on.
    
    For every save but a master's node-sync push, UpdateInbound now takes the
    client list and enable from the row it re-reads inside the writer; this
    replaces the lifecycle-only carry from the previous commit. Client
    validation (renewal schedule, Hysteria auth, TUIC credentials) moves after
    that swap so it judges the clients actually saved: a protocol switch keeps
    the stored clients, and #6268's refusal must apply to them.
    
    The edit form no longer loads or sends clients, so neither the JSON editor
    nor validation sees a copy the server ignores, and the enable switch shows
    only when adding; the list toggle (/setEnable) covers existing inbounds.
    
    Tests that added or re-keyed clients through a panel inbound save pinned
    the old rule; they now drive the master-push path, where payload clients
    still apply.
  • fix(mtproto): zero sidecar quotas only for clients whose usage was reset
    Invariant: the sidecar's quota counter for a client is zeroed exactly when
    the panel zeroes that client's usage. InboundService.ResetAllTraffics
    resets only inbound counters, yet it cleared every MTProto client's
    sidecar quota - on the master and, through its node propagation, on every
    node - handing out a fresh quota while the panel still counted the old
    usage. ResetAllClientTraffics for one inbound likewise cleared the quotas
    of MTProto clients on every other inbound.
    
    The inbound-level reset no longer touches sidecar quotas, and the
    per-inbound client reset zeroes only the clients it reset.
  • fix(traffic): make a client reset reach every counter enforcing its quota
    Invariant: a client traffic reset zeroes every counter that enforces the
    client's quota - the master's, each hosting node's, and the local MTProto
    sidecar's. A node cuts a client on its own local counters, and the master
    adopts that verdict when both judged the same limits (#4917).
    
    Node counters: ResetClientTraffic tried the node once and dropped a
    failure ("nothing replays a reset"); BulkResetTraffic,
    ResetAllClientTraffics and ClientService.ResetAllTraffics never told the
    node at all. The node kept its pre-reset usage, switched the client off
    again on its next tick, and the master latched that - a client shown at
    zero usage stayed disabled.
    
    Every reset path now queues a node_pending_resets row per hosting node in
    its own transaction. It is delivered right after commit (per-client
    endpoint up to the push threshold, bulkResetTraffic above) and replayed by
    the node sync ahead of its snapshot, and dropped only once the node
    accepted it. While one is owed, the merge takes only that client's usage
    from the node, not its enable or limits. Deliveries to a node are
    serialized so a reset is not sent twice.
    
    Sidecar quota: BulkResetTraffic, ClientService.ResetAllTraffics and
    auto-renew zeroed the panel counters but not mtg's own quota counter, so
    the sidecar kept refusing a renewed or reset MTProto client. They now
    reset it too, scoped to the affected clients.
  • fix(runtime): drop depleted clients by email, not by stale inbound_id
    Invariant: a client whose stats row is switched off is served by no local
    runtime of any inbound it is attached to. client_traffics is email-keyed,
    and AddClientStat re-points its inbound_id at the last inbound attached,
    yet the runtime push builder and the MTProto, TUIC and AmneziaWG desired-
    instance builders looked the row up by inbound_id. On every other inbound
    of a multi-inbound client the depletion filter saw nothing, so a depleted
    client stayed served there whenever its settings entry still read enabled
    - the state the stale settings writes left in existing databases.
    
    All four now resolve the flag through trafficDisabledEmails, keyed by the
    emails the inbound actually lists. GetXrayConfig already backfills sibling
    rows by email (backfillClientStats) and is unchanged.
  • fix(inbounds): keep stored client lifecycle and counters on inbound save
    Invariant: saving an inbound's configuration never changes a client's
    enable, expiry, quota or renewal state, nor the inbound's own traffic
    counters. The inbound modal posts back the whole settings.clients list it
    loaded when it opened, and UpdateInbound stored it, synced it into the
    client records and wrote it into client_traffics. Any client renewed,
    depleted or reset while the modal was open was reverted - a renewed client
    came back disabled with its old expiry. The row itself was read before the
    serialized tx and saved whole, so traffic the poll added in between was
    rolled back and a depleted inbound could be re-enabled.
    
    UpdateInbound now re-reads the row inside the writer and, for clients the
    inbound already holds, keeps enable, expiryTime, totalGB, reset, resetDay,
    resetWeekday and resetMax from it; those change through the client
    endpoints. A master's node-sync push stays authoritative. Existing clients'
    lifecycle fields are no longer editable through the inbound JSON editor or
    /inbounds/update, which the API docs now state.
  • 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.