hotfix(pia): port forwarding to use server name

This commit is contained in:
Quentin McGaw
2022-06-06 18:09:21 +00:00
parent 5e659dc5b3
commit 5359257c65
4 changed files with 12 additions and 9 deletions

View File

@@ -16,6 +16,8 @@ type Connection struct {
// Hostname is used for IPVanish, IVPN, Privado
// and Windscribe for TLS verification.
Hostname string `json:"hostname"`
// ServerName is used for PIA for port forwarding
ServerName string `json:"server_name,omitempty"`
// PubKey is the public key of the VPN server,
// used only for Wireguard.
PubKey string `json:"pubkey"`
@@ -24,7 +26,7 @@ type Connection struct {
func (c *Connection) Equal(other Connection) bool {
return c.IP.Equal(other.IP) && c.Port == other.Port &&
c.Protocol == other.Protocol && c.Hostname == other.Hostname &&
c.PubKey == other.PubKey
c.ServerName == other.ServerName && c.PubKey == other.PubKey
}
// UpdateEmptyWith updates each field of the connection where the

View File

@@ -65,6 +65,7 @@ func GetConnection(provider string,
Port: port,
Protocol: protocol,
Hostname: hostname,
ServerName: server.ServerName,
PubKey: server.WgPubKey, // Wireguard
}
connections = append(connections, connection)

View File

@@ -41,5 +41,5 @@ func setupOpenVPN(ctx context.Context, fw firewall.VPNConnectionSetter,
runner = openvpn.NewRunner(settings.OpenVPN, starter, logger)
return runner, connection.Hostname, nil
return runner, connection.ServerName, nil
}

View File

@@ -39,5 +39,5 @@ func setupWireguard(ctx context.Context, netlinker netlink.NetLinker,
return nil, "", fmt.Errorf("failed setting firewall: %w", err)
}
return wireguarder, connection.Hostname, nil
return wireguarder, connection.ServerName, nil
}