Obtain PIA v4 server information from API (#257)

- Obtain CN for port forwarding https verification
- Obtain for each server if they support port forwarding
- Obtain for each server their IP address for openvpn UDP and openvpn TCP (one for each)
- Updater program updated to use API
- Hardcoded values updated for PIA v3 and v4 servers
- Clearer separation between pia v3 and v4
- Fixes #250
This commit is contained in:
Quentin McGaw
2020-10-12 13:57:45 -04:00
committed by GitHub
parent ae7fc5fe96
commit 9f6450502c
13 changed files with 419 additions and 267 deletions

View File

@@ -1,7 +1,6 @@
package updater
import (
"net"
"strings"
)
@@ -15,18 +14,6 @@ func extractRemoteLinesFromOpenvpn(content []byte) (remoteLines []string) {
return remoteLines
}
func extractIPsFromRemoteLines(remoteLines []string) (ips []net.IP) {
for _, remoteLine := range remoteLines {
fields := strings.Fields(remoteLine)
ip := net.ParseIP(fields[1])
if ip == nil { // not an IP address
continue
}
ips = append(ips, ip)
}
return ips
}
func extractHostnamesFromRemoteLines(remoteLines []string) (hostnames []string) {
for _, remoteLine := range remoteLines {
fields := strings.Fields(remoteLine)