22
internal/params/nordvpn.go
Normal file
22
internal/params/nordvpn.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package params
|
||||
|
||||
import (
|
||||
libparams "github.com/qdm12/golibs/params"
|
||||
"github.com/qdm12/private-internet-access-docker/internal/constants"
|
||||
)
|
||||
|
||||
// GetNordvpnRegion obtains the region (country) for the NordVPN server from the
|
||||
// environment variable REGION
|
||||
func (r *reader) GetNordvpnRegion() (region string, err error) {
|
||||
return r.envParams.GetValueIfInside("REGION", constants.NordvpnRegionChoices())
|
||||
}
|
||||
|
||||
// GetNordvpnRegion obtains the server number (optional) for the NordVPN server from the
|
||||
// environment variable SERVER_NUMBER
|
||||
func (r *reader) GetNordvpnNumber() (number uint16, err error) {
|
||||
n, err := r.envParams.GetEnvIntRange("SERVER_NUMBER", 0, 65535, libparams.Default("0"))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return uint16(n), nil
|
||||
}
|
||||
@@ -81,6 +81,10 @@ type Reader interface {
|
||||
// Vyprvpn getters
|
||||
GetVyprvpnRegion() (region string, err error)
|
||||
|
||||
// NordVPN getters
|
||||
GetNordvpnRegion() (region string, err error)
|
||||
GetNordvpnNumber() (number uint16, err error)
|
||||
|
||||
// Shadowsocks getters
|
||||
GetShadowSocks() (activated bool, err error)
|
||||
GetShadowSocksLog() (activated bool, err error)
|
||||
@@ -123,7 +127,7 @@ func NewReader(logger logging.Logger, fileManager files.FileManager) Reader {
|
||||
|
||||
// GetVPNSP obtains the VPN service provider to use from the environment variable VPNSP
|
||||
func (r *reader) GetVPNSP() (vpnServiceProvider models.VPNProvider, err error) {
|
||||
s, err := r.envParams.GetValueIfInside("VPNSP", []string{"pia", "private internet access", "mullvad", "windscribe", "surfshark", "cyberghost", "vyprvpn"})
|
||||
s, err := r.envParams.GetValueIfInside("VPNSP", []string{"pia", "private internet access", "mullvad", "windscribe", "surfshark", "cyberghost", "vyprvpn", "nordvpn"})
|
||||
if s == "pia" {
|
||||
s = "private internet access"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user