mirror of
https://github.com/pia-foss/manual-connections.git
synced 2025-02-05 22:18:30 +00:00
improved output and comments for better user experience
This commit is contained in:
parent
e9aa8545ca
commit
7c933b10d5
|
@ -76,8 +76,8 @@ fi
|
||||||
# Notify the user that we got the server list.
|
# Notify the user that we got the server list.
|
||||||
echo "OK!"
|
echo "OK!"
|
||||||
|
|
||||||
# Test one server from each region to get the closest region
|
# Test one server from each region to get the closest region.
|
||||||
# Only filter port forwarding enabled servers if specified
|
# If port forwarding is enabled, filter out regions that don't support it.
|
||||||
if [[ $PIA_PF == "true" ]]; then
|
if [[ $PIA_PF == "true" ]]; then
|
||||||
echo Port Forwarding is enabled, so regions that do not support
|
echo Port Forwarding is enabled, so regions that do not support
|
||||||
echo port forwarding will get filtered out.
|
echo port forwarding will get filtered out.
|
||||||
|
@ -95,6 +95,14 @@ bestRegion="$(echo "$summarized_region_data" |
|
||||||
xargs -i bash -c 'printServerLatency {}' |
|
xargs -i bash -c 'printServerLatency {}' |
|
||||||
sort | head -1 | awk '{ print $2 }')"
|
sort | head -1 | awk '{ print $2 }')"
|
||||||
|
|
||||||
|
if [ -z "$bestRegion" ]; then
|
||||||
|
echo ...
|
||||||
|
echo No region responded within ${MAX_LATENCY}s, consider using a higher timeout.
|
||||||
|
echo For example, to wait 1 second for each region, inject MAX_LATENCY=1 like this:
|
||||||
|
echo $ MAX_LATENCY=1 ./get_region_and_token.sh
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Get all data for the best region
|
# Get all data for the best region
|
||||||
regionData="$( echo $all_region_data |
|
regionData="$( echo $all_region_data |
|
||||||
jq --arg REGION_ID "$bestRegion" -r \
|
jq --arg REGION_ID "$bestRegion" -r \
|
||||||
|
@ -160,8 +168,9 @@ echo "This token will expire in 24 hours.
|
||||||
|
|
||||||
if [ "$PIA_AUTOCONNECT" != wireguard ]; then
|
if [ "$PIA_AUTOCONNECT" != wireguard ]; then
|
||||||
echo If you wish to automatically connect to WireGuard after detecting the best
|
echo If you wish to automatically connect to WireGuard after detecting the best
|
||||||
echo region, please run the script with the env var PIA_AUTOCONNECT=wireguard. You can
|
echo region, please run the script with the env var PIA_AUTOCONNECT=wireguard.
|
||||||
echo also specify the env var PIA_PF=true to get port forwarding. Example:
|
echo You can echo also specify the env var PIA_PF=true to get port forwarding.
|
||||||
|
echo Example:
|
||||||
echo $ PIA_USER=p0123456 PIA_PASS=xxx \
|
echo $ PIA_USER=p0123456 PIA_PASS=xxx \
|
||||||
PIA_AUTOCONNECT=true PIA_PF=true ./sort_regions_by_latency.sh
|
PIA_AUTOCONNECT=true PIA_PF=true ./sort_regions_by_latency.sh
|
||||||
echo
|
echo
|
||||||
|
@ -175,8 +184,9 @@ if [ "$PIA_PF" != true ]; then
|
||||||
PIA_PF="false"
|
PIA_PF="false"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "The ./get_region_and_token.sh script got started with PIA_AUTOCONNECT=wireguard,
|
echo "The ./get_region_and_token.sh script got started with
|
||||||
so we will automatically connect to WireGuard, by running this command:
|
PIA_AUTOCONNECT=wireguard, so we will automatically connect to WireGuard,
|
||||||
|
by running this command:
|
||||||
$ WG_TOKEN=\"$token\" \\
|
$ WG_TOKEN=\"$token\" \\
|
||||||
WG_SERVER_IP=$bestServer_WG_IP WG_HOSTNAME=$bestServer_WG_hostname \\
|
WG_SERVER_IP=$bestServer_WG_IP WG_HOSTNAME=$bestServer_WG_hostname \\
|
||||||
PIA_PF=$PIA_PF ./connect_to_wireguard_with_token.sh
|
PIA_PF=$PIA_PF ./connect_to_wireguard_with_token.sh
|
||||||
|
|
Loading…
Reference in New Issue
Block a user