Added vscode server to list of checked servers.
This commit is contained in:
parent
0e399bad7d
commit
3d761583fa
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"sync"
|
"sync"
|
||||||
@ -18,6 +19,7 @@ var ServiceItems = map[string]Domain{
|
|||||||
"jellyfin": {Name: "jellyfin.aaronic.cc", Protocol: "https"},
|
"jellyfin": {Name: "jellyfin.aaronic.cc", Protocol: "https"},
|
||||||
"dnd": {Name: "dnd.aaronic.cc", Protocol: "https"},
|
"dnd": {Name: "dnd.aaronic.cc", Protocol: "https"},
|
||||||
"portainer": {Name: "portainer.aaronic.cc", Protocol: "https"},
|
"portainer": {Name: "portainer.aaronic.cc", Protocol: "https"},
|
||||||
|
"code": {Name: "code.aaronic.cc", Protocol: "https"},
|
||||||
}
|
}
|
||||||
|
|
||||||
type HealthChecker struct {
|
type HealthChecker struct {
|
||||||
@ -54,7 +56,12 @@ func (hc *HealthChecker) checkService(url string) {
|
|||||||
log.Printf("Error checking %s: %s", url, err)
|
log.Printf("Error checking %s: %s", url, err)
|
||||||
status.IsUp = false
|
status.IsUp = false
|
||||||
} else {
|
} else {
|
||||||
defer resp.Body.Close()
|
defer func(Body io.ReadCloser) {
|
||||||
|
err := Body.Close()
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error closing %s: %s", url, err)
|
||||||
|
}
|
||||||
|
}(resp.Body)
|
||||||
status.StatusCode = resp.StatusCode
|
status.StatusCode = resp.StatusCode
|
||||||
status.IsUp = resp.StatusCode >= 200 && resp.StatusCode < 300
|
status.IsUp = resp.StatusCode >= 200 && resp.StatusCode < 300
|
||||||
log.Printf("%s: %d", url, resp.StatusCode)
|
log.Printf("%s: %d", url, resp.StatusCode)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user