windows probe-only agent + agent version display unification + reality sni from sing-box fragment
Scope B (Windows agent): - probe.go split into shared core + probe_linux.go (verbatim Linux sampler, build-tagged) + probe_windows.go (Win32 sampler: GetSystemTimes CPU diff, GlobalMemoryStatusEx, fixed-drive df totals, GetIfTable2 counted set, MachineGuid boot identity, registry facts; load and TCP/UDP counts stay zero - x/sys v0.47.0 exports no wrapper) - update intents are acknowledged and skipped on Windows (the release assets are Linux binaries; Windows nodes update via install-agent.ps1) - cmd/xui-agent-windows: SCM service host (svc.Run + mgr install/ uninstall/start/stop) mirroring main.go's agent lifecycle wiring - install-agent.ps1: downloads the exe, writes probeOnly agent.json, registers and starts the service, rerun-safe Scope C (version display): - config.GetAgentDisplayVersion (and the master getter) compose from the bare number so a V-form injection no longer doubles the letter (AV2.1.0 -> A2.1.0) - node list view repairs stored AV-prefixed reports at assembly so deployed agents read uniformly without an update Scope D (production fix): - share-link reality sni: when the inbound has a sing-box fragment, sni is the fragment's tls.server_name - the only name the sing-box REALITY server serves. The previous rule picked a uniformly random serverNames entry per generation, which xray tolerated but sing-box refuses as an invalid connection. sid keeps its random pick: the converter carries the whole shortIds list into the fragment, so every listed sid is served.
This commit is contained in:
@@ -125,16 +125,30 @@ func GetDisplayVersion() string {
|
||||
return defaultDisplayVersion
|
||||
}
|
||||
|
||||
// bareDisplayVersion is GetDisplayVersion without a single leading
|
||||
// V/v. Release builds inject the number either bare ("2.1.0") or in
|
||||
// the master's V-form ("V2.1.0"); the letter-prefixed getters below
|
||||
// must compose from the bare form so the letter never doubles
|
||||
// ("VV2.1.0" / "AV2.1.0" — the latter is what agent rows showed when
|
||||
// the V-form was injected).
|
||||
func bareDisplayVersion() string {
|
||||
v := GetDisplayVersion()
|
||||
if len(v) > 1 && (v[0] == 'V' || v[0] == 'v') {
|
||||
return v[1:]
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// GetMasterDisplayVersion is the master's display version ("V1.0.0"),
|
||||
// shown in the panel's version slot.
|
||||
func GetMasterDisplayVersion() string {
|
||||
return "V" + GetDisplayVersion()
|
||||
return "V" + bareDisplayVersion()
|
||||
}
|
||||
|
||||
// GetAgentDisplayVersion is the agent's display version ("A1.0.0"),
|
||||
// reported in agent telemetry and shown on agent node rows.
|
||||
func GetAgentDisplayVersion() string {
|
||||
return "A" + GetDisplayVersion()
|
||||
return "A" + bareDisplayVersion()
|
||||
}
|
||||
|
||||
// ParseDisplayVersion parses a display version into its three numeric
|
||||
|
||||
@@ -75,6 +75,20 @@ func TestDisplayVersionDefaultsAndOverride(t *testing.T) {
|
||||
if got := GetAgentDisplayVersion(); got != "A1.0.1" {
|
||||
t.Fatalf("injected agent display version = %q, want A1.0.1", got)
|
||||
}
|
||||
|
||||
// A release build may inject the number in the master's V-form:
|
||||
// neither getter may double its letter ("VV1.0.2" / "AV1.0.2").
|
||||
displayVersion = "V1.0.2"
|
||||
if got := GetMasterDisplayVersion(); got != "V1.0.2" {
|
||||
t.Fatalf("V-injected master display version = %q, want V1.0.2", got)
|
||||
}
|
||||
if got := GetAgentDisplayVersion(); got != "A1.0.2" {
|
||||
t.Fatalf("V-injected agent display version = %q, want A1.0.2", got)
|
||||
}
|
||||
displayVersion = "v1.0.3"
|
||||
if got := GetAgentDisplayVersion(); got != "A1.0.3" {
|
||||
t.Fatalf("v-injected agent display version = %q, want A1.0.3", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseDisplayVersion(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user