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:
26
internal/provider/utils/nofetcher.go
Normal file
26
internal/provider/utils/nofetcher.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
|
||||
type NoFetcher struct {
|
||||
providerName string
|
||||
}
|
||||
|
||||
func NewNoFetcher(providerName string) *NoFetcher {
|
||||
return &NoFetcher{
|
||||
providerName: providerName,
|
||||
}
|
||||
}
|
||||
|
||||
var ErrFetcherNotSupported = errors.New("fetching of servers is not supported")
|
||||
|
||||
func (n *NoFetcher) FetchServers(ctx context.Context, minServers int) (
|
||||
servers []models.Server, err error) {
|
||||
return nil, fmt.Errorf("%w: for %s", ErrFetcherNotSupported, n.providerName)
|
||||
}
|
||||
Reference in New Issue
Block a user