chore(updater): incorporate FetchServers method in Provider interface

- Each provider interface can now fetch updated servers data
- Rename each provider updater subpackage name to `updater`
- Updater constructor does not take a settings struct
- Updater update method takes in a slice of provider strings
This commit is contained in:
Quentin McGaw
2022-06-09 23:47:12 +00:00
parent 11b55abff3
commit ebd94723c1
148 changed files with 374 additions and 281 deletions

View File

@@ -2,6 +2,7 @@ package cli
import (
"fmt"
"net/http"
"strings"
"time"
@@ -9,6 +10,7 @@ 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 {
@@ -35,7 +37,13 @@ func (c *CLI) OpenvpnConfig(logger OpenvpnConfigLogger, source sources.Source) e
return err
}
providerConf := provider.New(*allSettings.VPN.Provider.Name, storage, time.Now)
// Unused by this CLI command
unzipper := (unzip.Unzipper)(nil)
client := (*http.Client)(nil)
warner := (Warner)(nil)
providerConf := provider.New(*allSettings.VPN.Provider.Name, storage, time.Now,
warner, client, unzipper)
connection, err := providerConf.GetConnection(allSettings.VPN.Provider.ServerSelection)
if err != nil {
return err