@@ -1300,31 +1300,8 @@ function __protonvpn_verify_connection() {
1300
1300
log_debug " Connected to peer - ${configured_endpoints[*]} "
1301
1301
fi
1302
1302
1303
- # verify if server is correct.
1304
- local node_name
1305
- local node_dns
1303
+ # Verify if server is correct.
1306
1304
declare -a allowed_exit_ips
1307
-
1308
- node_name=" $( jq -r --arg peer " ${configured_endpoints[0]} " ' select(.Nodes[].PublicKey==$peer) | .Name' <<< " ${__PROTONWIRE_SRV_INFO}" 2> /dev/null) "
1309
- node_dns=" $( jq -r --arg peer " ${configured_endpoints[0]} " ' select(.Nodes[].PublicKey==$peer) | .DNS' <<< " ${__PROTONWIRE_SRV_INFO}" 2> /dev/null) "
1310
-
1311
- if [[ -n $PROTONVPN_SERVER ]]; then
1312
- if [[ ${PROTONVPN_SERVER^^} == " ${node_name^^} " ]] ||
1313
- [[ ${PROTONVPN_SERVER^^//#/ -} == " ${node_name^^} " ]] ||
1314
- [[ ${PROTONVPN_SERVER,,} == " ${node_dns,,} " ]]; then
1315
- log_debug " Connected to server: ${node_name:- NA} (${node_dns:- NA} )"
1316
- # server attributes are only validated if flags are specified
1317
- if ! __protonvpn_verify_server_attributes; then
1318
- return 1
1319
- fi
1320
- else
1321
- log_error " Expected to be connected to server $PROTONVPN_SERVER , but is connected to ${node_name:- NA} (${node_dns:- NA} )"
1322
- return 1
1323
- fi
1324
- else
1325
- log_debug " PROTONVPN_SERVER is not specified, only validating exit IPs"
1326
- fi
1327
-
1328
1305
readarray -t allowed_exit_ips < <( jq -r " .ExitIPs[]" <<< " ${__PROTONWIRE_SRV_INFO}" 2> /dev/null)
1329
1306
log_debug " Allowed ExitIPs - ${allowed_exit_ips[*]} "
1330
1307
@@ -1378,25 +1355,25 @@ function __protonvpn_verify_connection() {
1378
1355
if __has_notify_socket; then
1379
1356
local status_msg
1380
1357
if __is_enable_killswitch; then
1381
- status_msg=" Connected to ${node_dns } (via $client_ip , with KillSwitch)"
1358
+ status_msg=" Connected to ${PROTONVPN_SERVER } (as $client_ip , with KillSwitch)"
1382
1359
else
1383
- status_msg=" Connected to ${node_dns } (via $client_ip )"
1360
+ status_msg=" Connected to ${PROTONVPN_SERVER } (as $client_ip )"
1384
1361
fi
1385
1362
log_debug " $status_msg "
1386
1363
if ! __systemd_notify --status " $status_msg " ; then
1387
1364
log_error " Failed to notify status to systemd"
1388
1365
fi
1389
1366
else
1390
- log_success " Connected to ${node_dns :- NA} (via $client_ip )"
1367
+ log_success " Connected to ${PROTONVPN_SERVER :- NA} (as $client_ip )"
1391
1368
fi
1392
1369
return 0
1393
1370
fi
1394
1371
done
1395
- log_error " Your current IP address - ${client_ip} is not in the list for server ${node_dns :- NA} "
1372
+ log_error " Your current IP address - ${client_ip} is not in the list for server ${PROTONVPN_SERVER :- NA} "
1396
1373
log_error " Your current IP address - ${client_ip} must belong to set (${allowed_exit_ips[*]} )"
1397
1374
1398
1375
if __has_notify_socket; then
1399
- if ! __systemd_notify --status " ExitIP mismatch for server ${node_dns :- NA} (via $client_ip )" ; then
1376
+ if ! __systemd_notify --status " ExitIP mismatch for server ${PROTONVPN_SERVER :- NA} (as $client_ip )" ; then
1400
1377
log_error " Failed to notify error status to systemd"
1401
1378
fi
1402
1379
fi
0 commit comments