chore(publicip): refactoring

- Exported `Fetcher` interface
- Inject `Fetcher` to publicip loop and updaters
- Get public IP and information at the same time
- Only query ipinfo.io
- Make `MultiInfo` part of the `Fetch` object
This commit is contained in:
Quentin McGaw
2022-06-12 00:09:01 +00:00
parent 45c9e780c0
commit 83b4a3fe55
19 changed files with 101 additions and 155 deletions

View File

@@ -1,22 +1,20 @@
package updater
import (
"net/http"
"github.com/qdm12/gluetun/internal/provider/common"
)
type Updater struct {
client *http.Client
ipFetcher common.IPFetcher
unzipper common.Unzipper
parallelResolver common.ParallelResolver
warner common.Warner
}
func New(client *http.Client, unzipper common.Unzipper,
func New(ipFetcher common.IPFetcher, unzipper common.Unzipper,
warner common.Warner, parallelResolver common.ParallelResolver) *Updater {
return &Updater{
client: client,
ipFetcher: ipFetcher,
unzipper: unzipper,
parallelResolver: parallelResolver,
warner: warner,