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:
@@ -75,12 +75,17 @@ func (p *ProviderSettings) String() string {
|
||||
number = fmt.Sprintf("%d", p.ServerSelection.Number)
|
||||
}
|
||||
switch strings.ToLower(string(p.Name)) {
|
||||
case "private internet access":
|
||||
case "private internet access old":
|
||||
settingsList = append(settingsList,
|
||||
"Region: "+p.ServerSelection.Region,
|
||||
"Encryption preset: "+p.ExtraConfigOptions.EncryptionPreset,
|
||||
"Port forwarding: "+p.PortForwarding.String(),
|
||||
)
|
||||
case "private internet access":
|
||||
settingsList = append(settingsList,
|
||||
"Region: "+p.ServerSelection.Region,
|
||||
"Encryption preset: "+p.ExtraConfigOptions.EncryptionPreset,
|
||||
)
|
||||
case "mullvad":
|
||||
settingsList = append(settingsList,
|
||||
"Country: "+p.ServerSelection.Country,
|
||||
|
||||
@@ -1,12 +1,28 @@
|
||||
package models
|
||||
|
||||
import "net"
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func stringifyIPs(ips []net.IP) string {
|
||||
ipStrings := make([]string, len(ips))
|
||||
for i := range ips {
|
||||
ipStrings[i] = fmt.Sprintf("{%s}", strings.ReplaceAll(ips[i].String(), ".", ", "))
|
||||
}
|
||||
return strings.Join(ipStrings, ", ")
|
||||
}
|
||||
|
||||
type PIAServer struct {
|
||||
IPs []net.IP `json:"ips"`
|
||||
Region string `json:"region"`
|
||||
}
|
||||
|
||||
func (p *PIAServer) String() string {
|
||||
return fmt.Sprintf("{Region: %q, IPs: []net.IP{%s}}", p.Region, stringifyIPs(p.IPs))
|
||||
}
|
||||
|
||||
type MullvadServer struct {
|
||||
IPs []net.IP `json:"ips"`
|
||||
Country string `json:"country"`
|
||||
|
||||
@@ -5,6 +5,7 @@ type AllServers struct {
|
||||
Cyberghost CyberghostServers `json:"cyberghost"`
|
||||
Mullvad MullvadServers `json:"mullvad"`
|
||||
Nordvpn NordvpnServers `json:"nordvpn"`
|
||||
PiaOld PiaServers `json:"piaOld"`
|
||||
Pia PiaServers `json:"pia"`
|
||||
Purevpn PurevpnServers `json:"purevpn"`
|
||||
Surfshark SurfsharkServers `json:"surfshark"`
|
||||
|
||||
Reference in New Issue
Block a user