fix(custom): set server name if names filter is not empty

- fix PIA port forwarding code usage
- refers to #2147
This commit is contained in:
Quentin McGaw
2024-04-29 19:23:34 +00:00
parent bdc594c297
commit 72e2e4b82c

View File

@@ -40,16 +40,29 @@ func getOpenVPNConnection(extractor Extractor,
connection.Port = customPort
}
if len(selection.Names) > 0 {
// Set the server name for PIA port forwarding code used
// together with the custom provider.
connection.ServerName = selection.Names[0]
}
return connection, nil
}
func getWireguardConnection(selection settings.ServerSelection) (
connection models.Connection) {
return models.Connection{
Type: vpn.Wireguard,
IP: selection.Wireguard.EndpointIP,
Port: *selection.Wireguard.EndpointPort,
Protocol: constants.UDP,
PubKey: selection.Wireguard.PublicKey,
connection = models.Connection{
Type: vpn.Wireguard,
IP: selection.Wireguard.EndpointIP,
Port: *selection.Wireguard.EndpointPort,
Protocol: constants.UDP,
PubKey: selection.Wireguard.PublicKey,
ServerName: selection.Names[0],
}
if len(selection.Names) > 0 {
// Set the server name for PIA port forwarding code used
// together with the custom provider.
connection.ServerName = selection.Names[0]
}
return connection
}