Maint: healthcheck package interface rework

- return concrete struct type
- Add compilation checks for implementations
This commit is contained in:
Quentin McGaw (desktop)
2021-07-23 19:22:41 +00:00
parent c39ff5c233
commit 54610866f2
6 changed files with 64 additions and 54 deletions
+8 -1
View File
@@ -5,9 +5,16 @@ import (
"time"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/openvpn"
)
func (s *server) onUnhealthyOpenvpn(ctx context.Context) {
type openvpnHealth struct {
looper openvpn.Looper
healthyWait time.Duration
healthyTimer *time.Timer
}
func (s *Server) onUnhealthyOpenvpn(ctx context.Context) {
s.logger.Info("program has been unhealthy for " +
s.openvpn.healthyWait.String() + ": restarting OpenVPN")
_, _ = s.openvpn.looper.ApplyStatus(ctx, constants.Stopped)