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

@@ -1,6 +1,7 @@
package cli
import (
"context"
"fmt"
"net/http"
"strings"
@@ -10,18 +11,18 @@ import (
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/provider"
"github.com/qdm12/gluetun/internal/storage"
"github.com/qdm12/gluetun/internal/updater/unzip"
)
type OpenvpnConfigMaker interface {
OpenvpnConfig(logger OpenvpnConfigLogger, source sources.Source) error
}
type OpenvpnConfigLogger interface {
Info(s string)
Warn(s string)
}
type Unzipper interface {
FetchAndExtract(ctx context.Context, url string) (
contents map[string][]byte, err error)
}
func (c *CLI) OpenvpnConfig(logger OpenvpnConfigLogger, source sources.Source) error {
storage, err := storage.New(logger, constants.ServersData)
if err != nil {
@@ -38,7 +39,7 @@ func (c *CLI) OpenvpnConfig(logger OpenvpnConfigLogger, source sources.Source) e
}
// Unused by this CLI command
unzipper := (unzip.Unzipper)(nil)
unzipper := (Unzipper)(nil)
client := (*http.Client)(nil)
warner := (Warner)(nil)