- Update URLs logged by program - Update README.md links - Update contributing guide link - Update issue templates links - Replace Wiki issue template by link to Gluetun Wiki repository issue creation - Set program announcement about Github wiki new location
25 lines
658 B
Go
25 lines
658 B
Go
package healthcheck
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/qdm12/gluetun/internal/constants"
|
|
)
|
|
|
|
type vpnHealth struct {
|
|
loop StatusApplier
|
|
healthyWait time.Duration
|
|
healthyTimer *time.Timer
|
|
}
|
|
|
|
func (s *Server) onUnhealthyVPN(ctx context.Context) {
|
|
s.logger.Info("program has been unhealthy for " +
|
|
s.vpn.healthyWait.String() + ": restarting VPN " +
|
|
"(see https://github.com/qdm12/gluetun-wiki/blob/main/faq/healthcheck.md)")
|
|
_, _ = s.vpn.loop.ApplyStatus(ctx, constants.Stopped)
|
|
_, _ = s.vpn.loop.ApplyStatus(ctx, constants.Running)
|
|
s.vpn.healthyWait += *s.config.VPN.Addition
|
|
s.vpn.healthyTimer = time.NewTimer(s.vpn.healthyWait)
|
|
}
|