2021-05-11 17:10:51 +00:00
|
|
|
package protonvpn
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"math/rand"
|
2022-06-09 23:47:12 +00:00
|
|
|
"net/http"
|
2021-05-11 17:10:51 +00:00
|
|
|
|
2022-04-16 19:30:26 +00:00
|
|
|
"github.com/qdm12/gluetun/internal/constants/providers"
|
2022-06-05 14:58:46 +00:00
|
|
|
"github.com/qdm12/gluetun/internal/provider/common"
|
2022-06-09 23:47:12 +00:00
|
|
|
"github.com/qdm12/gluetun/internal/provider/protonvpn/updater"
|
2021-07-26 16:29:40 +00:00
|
|
|
"github.com/qdm12/gluetun/internal/provider/utils"
|
2021-05-11 17:10:51 +00:00
|
|
|
)
|
|
|
|
|
|
2022-05-27 18:05:04 +00:00
|
|
|
type Provider struct {
|
2022-06-05 14:58:46 +00:00
|
|
|
storage common.Storage
|
2021-05-11 17:10:51 +00:00
|
|
|
randSource rand.Source
|
2021-07-26 16:29:40 +00:00
|
|
|
utils.NoPortForwarder
|
2022-06-09 23:47:12 +00:00
|
|
|
common.Fetcher
|
2021-05-11 17:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-09 23:47:12 +00:00
|
|
|
func New(storage common.Storage, randSource rand.Source,
|
2022-06-11 17:41:57 +00:00
|
|
|
client *http.Client, updaterWarner common.Warner,
|
|
|
|
|
parallelResolver common.ParallelResolver) *Provider {
|
2022-05-27 18:05:04 +00:00
|
|
|
return &Provider{
|
2022-06-05 14:58:46 +00:00
|
|
|
storage: storage,
|
2021-07-26 16:29:40 +00:00
|
|
|
randSource: randSource,
|
2022-04-16 19:30:26 +00:00
|
|
|
NoPortForwarder: utils.NewNoPortForwarding(providers.Protonvpn),
|
2022-06-09 23:47:12 +00:00
|
|
|
Fetcher: updater.New(client, updaterWarner),
|
2021-05-11 17:10:51 +00:00
|
|
|
}
|
|
|
|
|
}
|
2022-06-07 16:58:08 +00:00
|
|
|
|
|
|
|
|
func (p *Provider) Name() string {
|
|
|
|
|
return providers.Protonvpn
|
|
|
|
|
}
|