- 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
27 lines
580 B
Go
27 lines
580 B
Go
package updater
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
func extractRemoteLinesFromOpenvpn(content []byte) (remoteLines []string) {
|
|
lines := strings.Split(string(content), "\n")
|
|
for _, line := range lines {
|
|
if strings.HasPrefix(line, "remote ") {
|
|
remoteLines = append(remoteLines, line)
|
|
}
|
|
}
|
|
return remoteLines
|
|
}
|
|
|
|
func extractHostnamesFromRemoteLines(remoteLines []string) (hostnames []string) {
|
|
for _, remoteLine := range remoteLines {
|
|
fields := strings.Fields(remoteLine)
|
|
if len(fields[1]) == 0 {
|
|
continue
|
|
}
|
|
hostnames = append(hostnames, fields[1])
|
|
}
|
|
return hostnames
|
|
}
|