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:
@@ -40,16 +40,29 @@ func getOpenVPNConnection(extractor Extractor,
|
|||||||
connection.Port = customPort
|
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
|
return connection, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getWireguardConnection(selection settings.ServerSelection) (
|
func getWireguardConnection(selection settings.ServerSelection) (
|
||||||
connection models.Connection) {
|
connection models.Connection) {
|
||||||
return models.Connection{
|
connection = models.Connection{
|
||||||
Type: vpn.Wireguard,
|
Type: vpn.Wireguard,
|
||||||
IP: selection.Wireguard.EndpointIP,
|
IP: selection.Wireguard.EndpointIP,
|
||||||
Port: *selection.Wireguard.EndpointPort,
|
Port: *selection.Wireguard.EndpointPort,
|
||||||
Protocol: constants.UDP,
|
Protocol: constants.UDP,
|
||||||
PubKey: selection.Wireguard.PublicKey,
|
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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user