Simplified provider object creation
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package provider
|
||||
|
||||
import (
|
||||
"github.com/qdm12/golibs/files"
|
||||
"github.com/qdm12/golibs/network"
|
||||
"github.com/qdm12/private-internet-access-docker/internal/constants"
|
||||
"github.com/qdm12/private-internet-access-docker/internal/models"
|
||||
@@ -10,24 +9,24 @@ import (
|
||||
// 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)
|
||||
BuildConf(connections []models.OpenVPNConnection, verbosity, uid, gid int, root bool, cipher, auth string, extras models.ExtraConfigOptions) (err error)
|
||||
GetPortForward() (port uint16, err error)
|
||||
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)
|
||||
}
|
||||
|
||||
func New(provider models.VPNProvider, client network.Client, fileManager files.FileManager) Provider {
|
||||
func New(provider models.VPNProvider) Provider {
|
||||
switch provider {
|
||||
case constants.PrivateInternetAccess:
|
||||
return newPrivateInternetAccess(client, fileManager)
|
||||
return newPrivateInternetAccess()
|
||||
case constants.Mullvad:
|
||||
return newMullvad(fileManager)
|
||||
return newMullvad()
|
||||
case constants.Windscribe:
|
||||
return newWindscribe(fileManager)
|
||||
return newWindscribe()
|
||||
case constants.Surfshark:
|
||||
return newSurfshark(fileManager)
|
||||
return newSurfshark()
|
||||
case constants.Cyberghost:
|
||||
return newCyberghost(fileManager)
|
||||
return newCyberghost()
|
||||
case constants.Vyprvpn:
|
||||
return newVyprvpn(fileManager)
|
||||
return newVyprvpn()
|
||||
default:
|
||||
return nil // should never occur
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user