Commit Graph
2 Commits
  • chore: refresh dependencies and modernize Go test idioms
    Frontend deps: @hookform/resolvers 5.4.3 -> 5.5.7, Storybook 10.5.4 -> 10.5.5
    across the four packages we declare, globals 17.7.0 -> 17.8.0, and jsdom
    29.1.1 -> 30.0.1. The jsdom major replaces its CSS and selector stack --
    @asamuzakjp/css-color 5 -> 6, @asamuzakjp/dom-selector 7 -> 8, undici 7 -> 8,
    nwsapi and generational-cache folded into their parents, whatwg-url 17 nested
    underneath. Nothing in the Vitest suites reaches those directly and the whole
    frontend gate (typecheck, lint, tests, build, Storybook compile) is green.
    Panel frontend version to 0.6.0.
    
    Backend deps: mattn/go-sqlite3 1.14.48 -> 1.14.49 and valyala/fasthttp
    1.72.0 -> 1.73.0, plus the golang.org/x/exp and genproto/googleapis/rpc
    indirect bumps that came with them.
    
    Go tests: modernize -fix output, covering range-over-int, sync.WaitGroup.Go
    in place of manual Add/Done pairs, maps.Copy, and Go 1.26 new(expr) for
    pointer-to-value in the forwarded-trust table. The storedAs helper is deleted
    instead of being left behind a //go:fix inline directive -- keeping it that way
    fails govet on the one call site the rewrite did not reach, and every caller now
    takes new(...) directly. Behaviour is unchanged.
    
    DnsTab: the hosts-sync effect tested dns while declaring dnsEnabled in its
    dependency array. Both carry the same truth value, so this is exhaustive-deps
    hygiene rather than a behaviour change.
  • fix(xray): stop the runtime user API from crashing xray-core
    Exercising the whole XrayAPI surface against a real xray-core 26.7.28 (the
    version go.mod pins) turned up a way for ordinary panel activity to kill the
    core process, plus two smaller mismatches with what the core actually does.
    
    buildUserAccount picked the shadowsocks account type by falling through to a
    2022 account whenever the cipher was not one of six hardcoded names. xray's
    legacy and 2022 inbounds cast the account they are handed without checking
    (proxy/shadowsocks/validator.go, proxy/shadowsocks_2022/inbound_multi.go), so
    the wrong type is not an error — it panics the core and drops every connection
    on the server. The fallback was reachable without any misconfiguration:
    autoRenewClients hands AddUser the client object straight out of the inbound's
    settings, where the cipher lives under "method", never "cipher", so every
    auto-renewed client on a legacy-cipher shadowsocks inbound took xray down. The
    xray-valid aead_* aliases hit it too. The cipher is now read from either key,
    matched with the same table (and case-insensitivity) the core's own conf
    package uses, and an unrecognized one is an error instead of a guess.
    
    The legacy shadowsocks validator is also the only one that accepts a second
    user under an email it already holds, and RemoveUser then drops just one of
    them — a disabled or expired client kept connecting. AddUser now drops the
    email first on that account type so a single removal fully revokes the client.
    
    GetTraffic skipped every stat the first time it saw it. xray creates a
    counter on a user's first use, so that dropped a new client's traffic for a
    whole polling interval, as did the counter reset after a core restart. Only
    the first poll of a process is a baseline now; later, unseen and rewound
    counters both count from zero.
    
    Also fixes three unchecked settings["method"].(string) assertions that panic
    the panel on a shadowsocks inbound whose settings carry no method, and bounds
    TestRoute's port so an out-of-range value cannot wrap into the uint32 the
    core is asked about.
    
    Tests: api_users_e2e_test.go drives add/remove for every protocol against a
    real core and asserts it survives each one (skipped unless XRAY_E2E_BINARY is
    set); the account-type, traffic-delta and renew paths get unit coverage.