Re-sync core/protocol/* from upstream (they were verbatim copies), re-fork
core/box.go onto the new upstream box.go, and adapt to changed APIs:
- adapter.ConnectionTracker gained RoutedFlow; add no-op impls to both trackers
- log.ObservableFactory gained AttachPlatformWriter; add no-op impl
- box.Context now takes a CertificateProviderRegistry; wire one up with
the origin_ca provider
- box.go now depends on debug*.go; copy them from upstream
- hysteria inbound moved QUIC option building into quic.go; copy it
Deps: sing v0.9.0-beta.4, sing-quic v0.7.0-beta.4, sing-tun v0.9.0-beta.2.
Runtime behaviour is not yet validated and config migration for options
deprecated in 1.14 is not done, so this is not ready for main.
* fix(hysteria2): use stable user identity on hot updates
Replace Service[int] (position-based) with Service[string] (name-based)
so that existing sessions retain a correct stable identity when the user
list changes via UpdateUsers. Remove the now-redundant userNameList field.
Fixes panic: runtime error: index out of range after user deletion,
and wrong username attribution when list positions shift.
* fix(hysteria2): gofmt struct field alignment after userNameList removal
* fix: extend stable user identity fix to hysteria, tuic, trojan, vless, vmess
The same Service[int] → Service[string] bug fixed for hysteria2 in the
previous commit affects all five remaining inbound protocols. When users
are deleted or reordered, integer position-based identity causes panics
(index out of range) and wrong username attribution in logs and traffic
stats.
Apply the same fix across hysteria v1, tuic, trojan, vless, and vmess:
- Service[int] → Service[string] in all five inbound structs
- Pass user.Name as the stable identity instead of the list index
- Remove the now-unnecessary cached `users []option.*User` fields from
trojan, vless, and vmess structs (they existed solely to map indexes
back to names)
- UpdateUsers helpers rebuilt to pass names, keeping auth/password
fields unchanged
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* ci: add go vet + gofmt check for patched protocols
* fix: gofmt struct field alignment in hysteria and tuic inbound
* fix: address review feedback on stable-identity PR
Three fixes from maintainer review:
1. Logging regression (trojan/vless/vmess): when a client has no name,
the old code fell back to the index as a log label; the new code was
emitting `[] inbound connection`. Align with the hysteria2 pattern:
omit the `[name]` prefix entirely when name is empty.
2. Duplicate/empty client names: trojan's Service.UpdateUsers rejects a
repeated identity, so two clients with the same name on the same
inbound would make UpdateUsers fail. vmess silently overwrites the
earlier entry. vless misattributes flow. Add server-side validation
in ClientService.Save (new, edit, addbulk) that rejects empty names
and names already in use on any shared inbound within the same tx.
3. Remove .github/workflows/check.yml: the workflow only triggered on
the feature branch, so it would be permanently dead after merge.
* fix: make client name validation global and trim whitespace
* ci: temporarily re-add check workflow for CI verification
* ci: remove temporary check workflow
* validate client names on bulk save paths too
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Alireza Ahmadi <alireza7@gmail.com>