This commit is contained in:
Locria Cyber 2023-09-30 16:58:01 +00:00
parent 4adf19a16b
commit 621d57c9e0
Signed by: iacore
GPG key ID: ED0D424AE4406330
2 changed files with 5 additions and 3 deletions

View file

@ -45,5 +45,5 @@ func LoadConfig() Config {
type ServiceStatus struct {
Name string
Ok bool
// Status string
Status string
}

View file

@ -4,19 +4,20 @@ import "log"
func TestService(service ServiceConfig) ServiceStatus {
var serviceResult bool
var status string
url := service.URL()
switch url.Scheme {
case "http", "https":
{
serviceResult = Request(url.String())
serviceResult, status = Request(url.String())
break
}
case "tcp":
{
// go includes port in host
serviceResult = CheckTCPOpen(url.Host)
serviceResult, status = CheckTCPOpen(url.Host)
break
}
default:
@ -27,5 +28,6 @@ func TestService(service ServiceConfig) ServiceStatus {
return ServiceStatus{
Name: service.description,
Ok: serviceResult,
Status: status,
}
}