Maint: package local narrow Logger interfaces

This commit is contained in:
Quentin McGaw (desktop)
2021-09-23 16:58:21 +00:00
parent d8e008606f
commit cf95692b93
57 changed files with 414 additions and 154 deletions

View File

@@ -0,0 +1,7 @@
package portforward
type Logger interface {
Info(s string)
Warn(s string)
Error(s string)
}

View File

@@ -11,7 +11,6 @@ import (
"github.com/qdm12/gluetun/internal/loopstate"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/portforward/state"
"github.com/qdm12/golibs/logging"
)
var _ Looper = (*Loop)(nil)
@@ -30,7 +29,7 @@ type Loop struct {
// Objects
client *http.Client
portAllower firewall.PortAllower
logger logging.Logger
logger Logger
// Internal channels and locks
start chan struct{}
running chan models.LoopStatus
@@ -45,7 +44,7 @@ const defaultBackoffTime = 5 * time.Second
func NewLoop(settings configuration.PortForwarding,
client *http.Client, portAllower firewall.PortAllower,
logger logging.Logger) *Loop {
logger Logger) *Loop {
start := make(chan struct{})
running := make(chan models.LoopStatus)
stop := make(chan struct{})

View File

@@ -38,7 +38,7 @@ func (l *Loop) Run(ctx context.Context, done chan<- struct{}) {
portCh <- port
// Infinite loop
err = startData.PortForwarder.KeepPortForward(ctx, l.client, l.logger,
err = startData.PortForwarder.KeepPortForward(ctx, l.client,
port, startData.Gateway, startData.ServerName)
errorCh <- err
}(pfCtx, startData)