fix: add time import for net.DialTimeout
This commit is contained in:
parent
a1d4368a0a
commit
ee29b28156
1 changed files with 5 additions and 2 deletions
7
main.go
7
main.go
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue