chore(all): return concrete types, accept interfaces

- Remove exported interfaces unused locally
- Define interfaces to accept arguments
- Return concrete types, not interfaces
This commit is contained in:
Quentin McGaw
2022-06-11 01:34:30 +00:00
parent 0378fe4a7b
commit 578ef768ab
132 changed files with 594 additions and 935 deletions

View File

@@ -7,28 +7,17 @@ import (
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/firewall"
"github.com/qdm12/gluetun/internal/loopstate"
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/gluetun/internal/portforward/state"
)
var _ Looper = (*Loop)(nil)
type Looper interface {
Runner
loopstate.Getter
StartStopper
SettingsGetSetter
Getter
}
type Loop struct {
statusManager loopstate.Manager
state state.Manager
statusManager statusManager
state StateManager
// Objects
client *http.Client
portAllower firewall.PortAllower
portAllower PortAllower
logger Logger
// Internal channels and locks
start chan struct{}
@@ -43,7 +32,7 @@ type Loop struct {
const defaultBackoffTime = 5 * time.Second
func NewLoop(settings settings.PortForwarding,
client *http.Client, portAllower firewall.PortAllower,
client *http.Client, portAllower PortAllower,
logger Logger) *Loop {
start := make(chan struct{})
running := make(chan models.LoopStatus)