- 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
30 lines
783 B
Go
30 lines
783 B
Go
package publicip
|
|
|
|
import (
|
|
"context"
|
|
"net"
|
|
|
|
"github.com/qdm12/gluetun/internal/configuration/settings"
|
|
"github.com/qdm12/gluetun/internal/models"
|
|
publicipmodels "github.com/qdm12/gluetun/internal/publicip/models"
|
|
)
|
|
|
|
type statusManager interface {
|
|
GetStatus() (status models.LoopStatus)
|
|
SetStatus(status models.LoopStatus)
|
|
ApplyStatus(ctx context.Context, status models.LoopStatus) (
|
|
outcome string, err error)
|
|
}
|
|
|
|
type stateManager interface {
|
|
GetData() (data publicipmodels.IPInfoData)
|
|
SetData(data publicipmodels.IPInfoData)
|
|
GetSettings() (settings settings.PublicIP)
|
|
SetSettings(ctx context.Context, settings settings.PublicIP) (outcome string)
|
|
}
|
|
|
|
type Fetcher interface {
|
|
FetchInfo(ctx context.Context, ip net.IP) (
|
|
result publicipmodels.IPInfoData, err error)
|
|
}
|