agent v0.3.16: statut service d'applications basé sur la connexion Tailscale effective

This commit is contained in:
EduBox Dev
2026-06-28 19:57:06 +00:00
parent adab165274
commit 41929be34c
3 changed files with 33 additions and 3 deletions
+1 -1
View File
@@ -1 +1 @@
0.3.15
0.3.16
+27
View File
@@ -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:<port>. This is required on Windows
// because userspace networking does not forward incoming connections to
+5 -2
View File
@@ -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"