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

@@ -5,6 +5,7 @@ import (
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/provider/common"
"github.com/qdm12/gluetun/internal/provider/cyberghost/updater"
"github.com/qdm12/gluetun/internal/provider/utils"
)
@@ -12,6 +13,7 @@ type Provider struct {
storage common.Storage
randSource rand.Source
utils.NoPortForwarder
common.Fetcher
}
func New(storage common.Storage, randSource rand.Source) *Provider {
@@ -19,6 +21,7 @@ func New(storage common.Storage, randSource rand.Source) *Provider {
storage: storage,
randSource: randSource,
NoPortForwarder: utils.NewNoPortForwarding(providers.Cyberghost),
Fetcher: updater.New(),
}
}

View File

@@ -1,4 +1,4 @@
package cyberghost
package updater
import "github.com/qdm12/gluetun/internal/constants"

View File

@@ -1,4 +1,4 @@
package cyberghost
package updater
func mergeCountryCodes(base, extend map[string]string) (merged map[string]string) {
merged = make(map[string]string, len(base))

View File

@@ -1,4 +1,4 @@
package cyberghost
package updater
import (
"net"

View File

@@ -1,4 +1,4 @@
package cyberghost
package updater
import (
"time"

View File

@@ -1,6 +1,6 @@
// Package cyberghost contains code to obtain the server information
// Package updater contains code to obtain the server information
// for the Cyberghost provider.
package cyberghost
package updater
import (
"context"

View File

@@ -1,4 +1,4 @@
package cyberghost
package updater
import (
"github.com/qdm12/gluetun/internal/provider/common"