agent v0.3.16: statut service d'applications basé sur la connexion Tailscale effective
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
|||||||
0.3.15
|
0.3.16
|
||||||
|
|||||||
@@ -213,6 +213,33 @@ func getTailscaleIP() string {
|
|||||||
return tsIP
|
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
|
// setupTailscaleServe configures Tailscale to proxy inbound Tailnet traffic
|
||||||
// on the given TCP port to localhost:<port>. This is required on Windows
|
// on the given TCP port to localhost:<port>. This is required on Windows
|
||||||
// because userspace networking does not forward incoming connections to
|
// because userspace networking does not forward incoming connections to
|
||||||
|
|||||||
+5
-2
@@ -363,12 +363,15 @@ func buildUIStatus(dataDir string) map[string]interface{} {
|
|||||||
appServiceDetail := "Vérification du service d'applications..."
|
appServiceDetail := "Vérification du service d'applications..."
|
||||||
engine := getContainerEngine()
|
engine := getContainerEngine()
|
||||||
if engineAvailable(engine) {
|
if engineAvailable(engine) {
|
||||||
if isTailscaleRunning() {
|
if isTailscaleReady() {
|
||||||
appServiceState = "ok"
|
appServiceState = "ok"
|
||||||
appServiceDetail = "Service d'applications prêt"
|
appServiceDetail = "Service d'applications prêt"
|
||||||
} else {
|
} else if isTailscaleRunning() {
|
||||||
appServiceState = "warn"
|
appServiceState = "warn"
|
||||||
appServiceDetail = "Service d'applications disponible, connexion sécurisée en cours"
|
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 {
|
} else {
|
||||||
appServiceState = "error"
|
appServiceState = "error"
|
||||||
|
|||||||
Reference in New Issue
Block a user