Files
gluetun/internal/provider/privateinternetaccess/provider.go
Quentin McGaw 0501743814 feat(pia): port forwarding options VPN_PORT_FORWARDING_USERNAME and VPN_PORT_FORWARDING_PASSWORD
- Retro-compatible with `OPENVPN_USER` + `OPENVPN_PASSWORD`
- No more reading for the OpenVPN auth file
- Allow to use PIA port forwarding with Wireguard
2024-07-09 14:44:46 +00:00

37 lines
875 B
Go

package privateinternetaccess
import (
"math/rand"
"net/http"
"time"
"github.com/qdm12/gluetun/internal/constants/providers"
"github.com/qdm12/gluetun/internal/provider/common"
"github.com/qdm12/gluetun/internal/provider/privateinternetaccess/updater"
)
type Provider struct {
storage common.Storage
randSource rand.Source
timeNow func() time.Time
common.Fetcher
// Port forwarding
portForwardPath string
}
func New(storage common.Storage, randSource rand.Source,
timeNow func() time.Time, client *http.Client) *Provider {
const jsonPortForwardPath = "/gluetun/piaportforward.json"
return &Provider{
storage: storage,
timeNow: timeNow,
randSource: randSource,
portForwardPath: jsonPortForwardPath,
Fetcher: updater.New(client),
}
}
func (p *Provider) Name() string {
return providers.PrivateInternetAccess
}