Files
gluetun/internal/provider/privateinternetaccess/provider.go
T

41 lines
1.0 KiB
Go

package privateinternetaccess
import (
"net/http"
"net/netip"
"time"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/provider/common"
"github.com/qdm12/gluetun/internal/provider/utils"
updaters "github.com/qdm12/gluetun/pkg/updaters/common"
"github.com/qdm12/gluetun/pkg/updaters/providers/privateinternetaccess"
)
type Provider struct {
storage common.Storage
connPicker *utils.ConnectionPicker
timeNow func() time.Time
updaters.Fetcher
// Port forwarding
portForwardPath string
apiIP netip.Addr
}
func New(storage common.Storage, timeNow func() time.Time,
client *http.Client,
) *Provider {
const jsonPortForwardPath = "/gluetun/piaportforward.json"
return &Provider{
storage: storage,
timeNow: timeNow,
connPicker: utils.NewConnectionPicker(),
portForwardPath: jsonPortForwardPath,
Fetcher: privateinternetaccess.New(client),
}
}
func (p *Provider) Name() string {
return providers.PrivateInternetAccess
}