Files
gluetun/internal/healthcheck/healthcheck.go
Quentin McGaw 768147095f Golangcilint in build pipeline and fix lint errors
- Fix bad permissions bits for files
- VPNSP is 'private internet access' instead of 'pia' (retro compatible)
- Check errors of deferred unsetEnv functions in params package
-  Other lint errors fixing and code simplifications
2020-04-12 20:05:28 +00:00

25 lines
541 B
Go

package healthcheck
import (
"fmt"
"strings"
"time"
"github.com/qdm12/golibs/network/connectivity"
)
func HealthCheck() error {
// DNS, HTTP and HTTPs check on github.com
connectivity := connectivity.NewConnectivity(3 * time.Second)
errs := connectivity.Checks("github.com")
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
}