New PIA servers support (#227)
* Adapt storage: SyncServers write to file option, export FlushToFile * CLI built-in updater for old and new PIA servers * Update hardcoded IP addresses for PIA old and new servers * Add PIA old to allServers struct and update timestamps * Adapt code to work with new and old PIA servers * Remove PIA subdomains (unneeded) from resolver tool
This commit is contained in:
@@ -60,6 +60,7 @@ type Reader interface {
|
||||
GetPortForwardingStatusFilepath() (filepath models.Filepath, err error)
|
||||
GetPIAEncryptionPreset() (preset string, err error)
|
||||
GetPIARegion() (region string, err error)
|
||||
GetPIAOldRegion() (region string, err error)
|
||||
|
||||
// Mullvad getters
|
||||
GetMullvadCountry() (country string, err error)
|
||||
@@ -136,7 +137,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", "nordvpn", "purevpn"})
|
||||
s, err := r.envParams.GetValueIfInside("VPNSP", []string{"pia", "private internet access", "private internet access old", "mullvad", "windscribe", "surfshark", "cyberghost", "vyprvpn", "nordvpn", "purevpn"})
|
||||
if s == "pia" {
|
||||
s = "private internet access"
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
// GetPortForwarding obtains if port forwarding on the VPN provider server
|
||||
// side is enabled or not from the environment variable PORT_FORWARDING
|
||||
// Only valid for older PIA servers for now
|
||||
func (r *reader) GetPortForwarding() (activated bool, err error) {
|
||||
s, err := r.envParams.GetEnv("PORT_FORWARDING", libparams.Default("off"))
|
||||
if err != nil {
|
||||
@@ -61,3 +62,10 @@ func (r *reader) GetPIARegion() (region string, err error) {
|
||||
choices := append(constants.PIAGeoChoices(), "")
|
||||
return r.envParams.GetValueIfInside("REGION", choices)
|
||||
}
|
||||
|
||||
// GetPIAOldRegion obtains the region for the PIA server from the
|
||||
// environment variable REGION
|
||||
func (r *reader) GetPIAOldRegion() (region string, err error) {
|
||||
choices := append(constants.PIAOldGeoChoices(), "")
|
||||
return r.envParams.GetValueIfInside("REGION", choices)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user