Files
gluetun/internal/cli/cli.go

25 lines
533 B
Go
Raw Normal View History

package cli
2020-02-08 21:50:17 +00:00
import (
"fmt"
"strings"
"time"
"github.com/qdm12/golibs/network/connectivity"
2020-02-08 21:50:17 +00:00
)
func HealthCheck() error {
// DNS, HTTP and HTTPs check on github.com
connectivity := connectivity.NewConnectivity(3 * time.Second)
errs := connectivity.Checks("github.com")
2020-02-08 21:50:17 +00:00
if len(errs) > 0 {
var errsStr []string
for _, err := range errs {
errsStr = append(errsStr, err.Error())
}
return fmt.Errorf("Multiple errors: %s", strings.Join(errsStr, "; "))
}
// TODO check IP address is in the right region
return nil
}