Files
gluetun/internal/provider/provider.go

38 lines
1.2 KiB
Go
Raw Normal View History

package provider
import (
"github.com/qdm12/golibs/network"
"github.com/qdm12/private-internet-access-docker/internal/constants"
"github.com/qdm12/private-internet-access-docker/internal/models"
)
// Provider contains methods to read and modify the openvpn configuration to connect as a client
type Provider interface {
GetOpenVPNConnections(selection models.ServerSelection) (connections []models.OpenVPNConnection, err error)
2020-07-13 23:34:03 +00:00
BuildConf(connections []models.OpenVPNConnection, verbosity, uid, gid int, root bool, cipher, auth string, extras models.ExtraConfigOptions) (lines []string)
GetPortForward(client network.Client) (port uint16, err error)
}
2020-07-13 23:34:03 +00:00
func New(provider models.VPNProvider) Provider {
switch provider {
case constants.PrivateInternetAccess:
2020-07-13 23:34:03 +00:00
return newPrivateInternetAccess()
case constants.Mullvad:
2020-07-13 23:34:03 +00:00
return newMullvad()
case constants.Windscribe:
2020-07-13 23:34:03 +00:00
return newWindscribe()
case constants.Surfshark:
2020-07-13 23:34:03 +00:00
return newSurfshark()
case constants.Cyberghost:
2020-07-13 23:34:03 +00:00
return newCyberghost()
2020-07-13 08:04:35 -04:00
case constants.Vyprvpn:
2020-07-13 23:34:03 +00:00
return newVyprvpn()
2020-07-15 18:14:45 -04:00
case constants.Nordvpn:
return newNordvpn()
2020-07-25 11:19:45 -04:00
case constants.Purevpn:
return newPurevpn()
default:
return nil // should never occur
}
}