- 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
29 lines
607 B
Go
29 lines
607 B
Go
package common
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"net"
|
|
|
|
"github.com/qdm12/gluetun/internal/models"
|
|
)
|
|
|
|
var ErrNotEnoughServers = errors.New("not enough servers found")
|
|
|
|
type Fetcher interface {
|
|
FetchServers(ctx context.Context, minServers int) (servers []models.Server, err error)
|
|
}
|
|
|
|
type ParallelResolver interface {
|
|
Resolve(ctx context.Context, hosts []string, minToFind int) (
|
|
hostToIPs map[string][]net.IP, warnings []string, err error)
|
|
}
|
|
|
|
type Unzipper interface {
|
|
FetchAndExtract(ctx context.Context, url string) (contents map[string][]byte, err error)
|
|
}
|
|
|
|
type Warner interface {
|
|
Warn(s string)
|
|
}
|