agent v0.3.16: statut service d'applications basé sur la connexion Tailscale effective
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user