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 // Hostname is used for IPVanish, IVPN, Privado
// and Windscribe for TLS verification. // and Windscribe for TLS verification.
Hostname string `json:"hostname"` 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, // PubKey is the public key of the VPN server,
// used only for Wireguard. // used only for Wireguard.
PubKey string `json:"pubkey"` PubKey string `json:"pubkey"`
@@ -24,7 +26,7 @@ type Connection struct {
func (c *Connection) Equal(other Connection) bool { func (c *Connection) Equal(other Connection) bool {
return c.IP.Equal(other.IP) && c.Port == other.Port && return c.IP.Equal(other.IP) && c.Port == other.Port &&
c.Protocol == other.Protocol && c.Hostname == other.Hostname && 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 // UpdateEmptyWith updates each field of the connection where the

View File

@@ -60,12 +60,13 @@ func GetConnection(provider string,
} }
connection := models.Connection{ connection := models.Connection{
Type: selection.VPN, Type: selection.VPN,
IP: ip, IP: ip,
Port: port, Port: port,
Protocol: protocol, Protocol: protocol,
Hostname: hostname, Hostname: hostname,
PubKey: server.WgPubKey, // Wireguard ServerName: server.ServerName,
PubKey: server.WgPubKey, // Wireguard
} }
connections = append(connections, connection) 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) 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 nil, "", fmt.Errorf("failed setting firewall: %w", err)
} }
return wireguarder, connection.Hostname, nil return wireguarder, connection.ServerName, nil
} }