From 41929be34cde69cf3f4c11e0744b308744236d10 Mon Sep 17 00:00:00 2001 From: EduBox Dev Date: Sun, 28 Jun 2026 19:57:06 +0000 Subject: [PATCH] =?UTF-8?q?agent=20v0.3.16:=20statut=20service=20d'applica?= =?UTF-8?q?tions=20bas=C3=A9=20sur=20la=20connexion=20Tailscale=20effectiv?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agent/VERSION | 2 +- agent/tailscale.go | 27 +++++++++++++++++++++++++++ agent/ui.go | 7 +++++-- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/agent/VERSION b/agent/VERSION index 9e29e10..ec96a62 100644 --- a/agent/VERSION +++ b/agent/VERSION @@ -1 +1 @@ -0.3.15 +0.3.16 diff --git a/agent/tailscale.go b/agent/tailscale.go index aeb86e1..91135ef 100644 --- a/agent/tailscale.go +++ b/agent/tailscale.go @@ -213,6 +213,33 @@ func getTailscaleIP() string { return tsIP } +// isTailscaleReady reports whether tailscaled is running and has successfully +// joined the tailnet (i.e. it has a Tailscale IP). This is a stronger check +// than isTailscaleRunning which only verifies the process exists. +func isTailscaleReady() bool { + if !isTailscaleRunning() { + return false + } + tsCmdMu.Lock() + socket := tsSocket + tsCmdMu.Unlock() + if socket == "" { + return false + } + + statusCmd := exec.Command(tailscaleBin("tailscale"), "--socket="+socket, "status", "--json") + hideWindow(statusCmd) + out, err := statusCmd.Output() + if err != nil { + return false + } + var st tailscaleStatus + if err := json.Unmarshal(out, &st); err != nil { + return false + } + return len(st.Self.TailscaleIPs) > 0 +} + // setupTailscaleServe configures Tailscale to proxy inbound Tailnet traffic // on the given TCP port to localhost:. This is required on Windows // because userspace networking does not forward incoming connections to diff --git a/agent/ui.go b/agent/ui.go index 4c51dc5..c33cca5 100644 --- a/agent/ui.go +++ b/agent/ui.go @@ -363,12 +363,15 @@ func buildUIStatus(dataDir string) map[string]interface{} { appServiceDetail := "Vérification du service d'applications..." engine := getContainerEngine() if engineAvailable(engine) { - if isTailscaleRunning() { + if isTailscaleReady() { appServiceState = "ok" appServiceDetail = "Service d'applications prêt" - } else { + } else if isTailscaleRunning() { appServiceState = "warn" appServiceDetail = "Service d'applications disponible, connexion sécurisée en cours" + } else { + appServiceState = "warn" + appServiceDetail = "Service d'applications disponible, connexion sécurisée inactive" } } else { appServiceState = "error"