PIA and Windscribe hardcoded IP addresses
- Allows to not need to resolve subdomains at start before tunneling - Allows for Unbound to be configured and started after tunneling - Refers to #127
This commit is contained in:
@@ -11,20 +11,14 @@ import (
|
||||
)
|
||||
|
||||
func (c *configurator) GetOpenVPNConnections(region models.WindscribeRegion, protocol models.NetworkProtocol, customPort uint16, targetIP net.IP) (connections []models.OpenVPNConnection, err error) {
|
||||
var subdomain string
|
||||
var IPs []net.IP
|
||||
for _, server := range constants.WindscribeServers() {
|
||||
if server.Region == region {
|
||||
subdomain = server.Subdomain
|
||||
break
|
||||
if strings.EqualFold(string(server.Region), string(region)) {
|
||||
IPs = server.IPs
|
||||
}
|
||||
}
|
||||
if len(subdomain) == 0 {
|
||||
return nil, fmt.Errorf("no server found for region %q", region)
|
||||
}
|
||||
hostname := subdomain + ".windscribe.com"
|
||||
IPs, err := c.lookupIP(hostname)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if len(IPs) == 0 {
|
||||
return nil, fmt.Errorf("no IP found for region %q", region)
|
||||
}
|
||||
if targetIP != nil {
|
||||
found := false
|
||||
@@ -35,7 +29,7 @@ func (c *configurator) GetOpenVPNConnections(region models.WindscribeRegion, pro
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
return nil, fmt.Errorf("target IP address %q not found from IP addresses resolved from %s", targetIP, hostname)
|
||||
return nil, fmt.Errorf("target IP address %q not found in IP addresses", targetIP)
|
||||
}
|
||||
IPs = []net.IP{targetIP}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user