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:
@@ -87,7 +87,9 @@ func Test_Provider_GetConnection(t *testing.T) {
|
||||
Return(testCase.filteredServers, testCase.storageErr)
|
||||
randSource := rand.NewSource(0)
|
||||
|
||||
provider := New(storage, randSource)
|
||||
unzipper := (common.Unzipper)(nil)
|
||||
warner := (common.Warner)(nil)
|
||||
provider := New(storage, randSource, unzipper, warner)
|
||||
|
||||
if testCase.panicMessage != "" {
|
||||
assert.PanicsWithValue(t, testCase.panicMessage, func() {
|
||||
|
||||
@@ -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/expressvpn/updater"
|
||||
"github.com/qdm12/gluetun/internal/provider/utils"
|
||||
)
|
||||
|
||||
@@ -12,13 +13,16 @@ type Provider struct {
|
||||
storage common.Storage
|
||||
randSource rand.Source
|
||||
utils.NoPortForwarder
|
||||
common.Fetcher
|
||||
}
|
||||
|
||||
func New(storage common.Storage, randSource rand.Source) *Provider {
|
||||
func New(storage common.Storage, randSource rand.Source,
|
||||
unzipper common.Unzipper, updaterWarner common.Warner) *Provider {
|
||||
return &Provider{
|
||||
storage: storage,
|
||||
randSource: randSource,
|
||||
NoPortForwarder: utils.NewNoPortForwarding(providers.Expressvpn),
|
||||
Fetcher: updater.New(unzipper, updaterWarner),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package expressvpn
|
||||
package updater
|
||||
|
||||
import (
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package expressvpn
|
||||
package updater
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// package expressvpn contains code to obtain the server information
|
||||
// Package updater contains code to obtain the server information
|
||||
// for the ExpressVPN provider.
|
||||
package expressvpn
|
||||
package updater
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package expressvpn
|
||||
package updater
|
||||
|
||||
import (
|
||||
"github.com/qdm12/gluetun/internal/provider/common"
|
||||
|
||||
Reference in New Issue
Block a user