fix(health): use TCP dialing instead of ping

- `HEALTH_TARGET_ADDRESS` to replace `HEALTH_ADDRESS_TO_PING`
- Remove `github.com/go-ping/ping` dependency
- Dial TCP the target address, appending `:443` if port is not set
This commit is contained in:
Quentin McGaw
2022-03-21 19:57:35 +00:00
parent 5aaa122460
commit c6f68a64e6
12 changed files with 131 additions and 227 deletions

View File

@@ -2,6 +2,7 @@ package healthcheck
import (
"context"
"net"
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/vpn"
@@ -16,7 +17,7 @@ type ServerRunner interface {
type Server struct {
logger Logger
handler *handler
pinger Pinger
dialer *net.Dialer
config settings.Health
vpn vpnHealth
}
@@ -26,7 +27,7 @@ func NewServer(config settings.Health,
return &Server{
logger: logger,
handler: newHandler(),
pinger: newPinger(config.AddressToPing),
dialer: &net.Dialer{},
config: config,
vpn: vpnHealth{
looper: vpnLooper,