From 53cbd839a6a532190e96a310a3bf48e472ea61b5 Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Tue, 26 Sep 2023 13:48:45 +0000 Subject: [PATCH] chore(protonvpn): add debug logs for keeping port forwarded --- internal/portforward/service/interfaces.go | 1 + internal/provider/protonvpn/portforward.go | 3 +++ internal/provider/utils/logger.go | 1 + 3 files changed, 5 insertions(+) diff --git a/internal/portforward/service/interfaces.go b/internal/portforward/service/interfaces.go index eed258696..df9b91b8b 100644 --- a/internal/portforward/service/interfaces.go +++ b/internal/portforward/service/interfaces.go @@ -17,6 +17,7 @@ type Routing interface { } type Logger interface { + Debug(s string) Info(s string) Warn(s string) Error(s string) diff --git a/internal/provider/protonvpn/portforward.go b/internal/provider/protonvpn/portforward.go index f04d73a80..1002f107c 100644 --- a/internal/provider/protonvpn/portforward.go +++ b/internal/provider/protonvpn/portforward.go @@ -85,6 +85,7 @@ func (p *Provider) KeepPortForward(ctx context.Context, case <-timer.C: } + objects.Logger.Debug("refreshing port forward since 45 seconds have elapsed") networkProtocols := []string{"udp", "tcp"} const internalPort = 0 const lifetime = 60 * time.Second @@ -109,6 +110,8 @@ func (p *Provider) KeepPortForward(ctx context.Context, } } + objects.Logger.Debug(fmt.Sprintf("port forwarded %d maintained", p.portForwarded)) + timer.Reset(refreshTimeout) } } diff --git a/internal/provider/utils/logger.go b/internal/provider/utils/logger.go index d31897604..3a4674ab7 100644 --- a/internal/provider/utils/logger.go +++ b/internal/provider/utils/logger.go @@ -1,6 +1,7 @@ package utils type Logger interface { + Debug(s string) Info(s string) Warn(s string) Error(s string)