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:
@@ -52,6 +52,15 @@ var execSelf = func(path string) error {
|
||||
return syscall.Exec(path, append([]string{path}, os.Args[1:]...), os.Environ())
|
||||
}
|
||||
|
||||
// selfUpdateSupported reports whether this platform can consume a
|
||||
// master update intent. Windows agents are the standalone
|
||||
// xui-agent-windows binary (see cmd/xui-agent-windows), serviced by
|
||||
// re-running install-agent.ps1: the release assets an intent points
|
||||
// at are the panel's Linux binaries, so an intent delivered to a
|
||||
// Windows node is acknowledged and skipped, never downloaded.
|
||||
// A package variable so tests can exercise the skip on any OS.
|
||||
var selfUpdateSupported = runtime.GOOS != "windows"
|
||||
|
||||
func (a *Agent) setUpdateReport(st agentUpdateStatus) {
|
||||
a.updateMu.Lock()
|
||||
cp := st
|
||||
@@ -82,6 +91,19 @@ func (a *Agent) maybeHandleUpdate(intent *updateIntent) {
|
||||
a.updateMu.Unlock()
|
||||
return
|
||||
}
|
||||
if !selfUpdateSupported {
|
||||
// Windows (see selfUpdateSupported): log once per intent and
|
||||
// mark it handled so the poll does not re-log it every cycle.
|
||||
// No report is filed — the master-side intent simply ages out,
|
||||
// and the node updates by re-running install-agent.ps1.
|
||||
a.updateMu.Lock()
|
||||
if intent.RequestedAt != a.updateHandled {
|
||||
a.updateHandled = intent.RequestedAt
|
||||
logger.Infof("agent update to %s offered but skipped on %s: Windows agents update by re-running install-agent.ps1", intent.Target, runtime.GOOS)
|
||||
}
|
||||
a.updateMu.Unlock()
|
||||
return
|
||||
}
|
||||
a.updateMu.Lock()
|
||||
if a.updateRunning || intent.RequestedAt == a.updateHandled ||
|
||||
(intent.RequestedAt == a.updateFailedReq && time.Since(a.updateFailedAt) < updateRetryBackoff) {
|
||||
|
||||
Reference in New Issue
Block a user