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"
"io"
"log"
"net"
"net/http"
"net/http/httputil"
"net/url"
@ -14,6 +15,7 @@ import (
"path/filepath"
"strconv"
"strings"
"time"
"gopkg.in/yaml.v3"
)
@ -295,9 +297,10 @@ func adminHandler(w http.ResponseWriter, r *http.Request) {
resp.Body.Close()
}
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
resp.Body.Close()
conn.Close()
}
launcherUp := false
if resp, err := http.Get("http://127.0.0.1:9000/health"); err == nil {