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:
@@ -2,11 +2,13 @@ package vpn
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants"
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/internal/provider"
|
||||
"github.com/qdm12/gluetun/internal/updater/unzip"
|
||||
"github.com/qdm12/log"
|
||||
)
|
||||
|
||||
@@ -27,10 +29,16 @@ func (l *Loop) Run(ctx context.Context, done chan<- struct{}) {
|
||||
return
|
||||
}
|
||||
|
||||
// Updater only objects which are unused in this loop
|
||||
updaterWarner := (log.LoggerInterface)(nil)
|
||||
updaterClient := (*http.Client)(nil)
|
||||
updaterUnzipper := (unzip.Unzipper)(nil)
|
||||
|
||||
for ctx.Err() == nil {
|
||||
settings := l.state.GetSettings()
|
||||
|
||||
providerConf := provider.New(*settings.Provider.Name, l.storage, time.Now)
|
||||
providerConf := provider.New(*settings.Provider.Name, l.storage, time.Now,
|
||||
updaterWarner, updaterClient, updaterUnzipper)
|
||||
|
||||
portForwarding := *settings.Provider.PortForwarding.Enabled
|
||||
var vpnRunner vpnRunner
|
||||
|
||||
Reference in New Issue
Block a user