fix: add time import for net.DialTimeout

This commit is contained in:
Claus Lohmar 2026-07-10 12:03:37 +01:00
parent a1d4368a0a
commit ee29b28156

View file

@ -6,6 +6,7 @@ import (
"html/template" "html/template"
"io" "io"
"log" "log"
"net"
"net/http" "net/http"
"net/http/httputil" "net/http/httputil"
"net/url" "net/url"
@ -14,6 +15,7 @@ import (
"path/filepath" "path/filepath"
"strconv" "strconv"
"strings" "strings"
"time"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
) )
@ -295,9 +297,10 @@ func adminHandler(w http.ResponseWriter, r *http.Request) {
resp.Body.Close() resp.Body.Close()
} }
caddyUp := false caddyUp := false
if resp, err := http.Get("http://127.0.0.1:80/"); err == nil { // Check port 80 responds (don't follow HTTPS redirect)
if conn, err := net.DialTimeout("tcp", "127.0.0.1:80", 3*time.Second); err == nil {
caddyUp = true caddyUp = true
resp.Body.Close() conn.Close()
} }
launcherUp := false launcherUp := false
if resp, err := http.Get("http://127.0.0.1:9000/health"); err == nil { if resp, err := http.Get("http://127.0.0.1:9000/health"); err == nil {