hotfix(pia): port forwarding to use server name
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -60,12 +60,13 @@ func GetConnection(provider string,
|
||||
}
|
||||
|
||||
connection := models.Connection{
|
||||
Type: selection.VPN,
|
||||
IP: ip,
|
||||
Port: port,
|
||||
Protocol: protocol,
|
||||
Hostname: hostname,
|
||||
PubKey: server.WgPubKey, // Wireguard
|
||||
Type: selection.VPN,
|
||||
IP: ip,
|
||||
Port: port,
|
||||
Protocol: protocol,
|
||||
Hostname: hostname,
|
||||
ServerName: server.ServerName,
|
||||
PubKey: server.WgPubKey, // Wireguard
|
||||
}
|
||||
connections = append(connections, connection)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user