mirror of
https://github.com/pia-foss/manual-connections.git
synced 2025-02-05 14:08:29 +00:00
Integration of One-Line Call for DIP
Integrated one-line call support for DIP_TOKEN=none Fixed formatting issue introduced by longer server names of new servers Fixed spacing to normalize output in all conditions Updated readme to provide details about new one-line call example
This commit is contained in:
parent
9b42ad934a
commit
4e5714ecc5
|
@ -83,7 +83,7 @@ In order to help you use VPN services and PF on any device, we have prepared a f
|
|||
|
||||
The easiest way to trigger a fully automated connection is by running this oneliner:
|
||||
```
|
||||
sudo VPN_PROTOCOL=wireguard DISABLE_IPV6="no" AUTOCONNECT=true PIA_PF=false PIA_USER=p0123456 PIA_PASS=xxxxxxxx ./run_setup.sh
|
||||
sudo VPN_PROTOCOL=wireguard DISABLE_IPV6=yes DIP_TOKEN=no AUTOCONNECT=true PIA_PF=false PIA_DNS=true PIA_USER=p0123456 PIA_PASS=xxxxxxxx ./run_setup.sh
|
||||
```
|
||||
|
||||
Here is a list of scripts you could find useful:
|
||||
|
@ -100,6 +100,7 @@ Here is a list of scripts you could find useful:
|
|||
* `DISABLE_IPV6` - yes/no
|
||||
* [Get region details](get_region.sh): This script will provide server details, validate `PREFERRED_REGION` input, and can determine the lowest latency location. The script can also trigger VPN connections, if you specify `VPN_PROTOCOL=wireguard` or `VPN_PROTOCOL=openvpn`; doing so requires a token. This script can reference `get_token.sh` with use of `PIA_USER` and `PIA_PASS`. If called without specifying `PREFERRED_REGION` this script writes a list of servers within lower than `MAX_LATENCY` to a `/opt/piavpn-manual/latencyList` for reference.
|
||||
* [Get a token](get_token.sh): This script allows you to get an authentication token with a valid 'PIA_USER' and 'PIA_PASS'. It will write the token and its expiration date to `/opt/piavpn-manual/token` for reference.
|
||||
* [Get DIP details](get_dip.sh): This script will provide necessary connection details to use a dedicated IP.
|
||||
* [Connect to WireGuard](connect_to_wireguard_with_token.sh): This script allows you to connect to the VPN server via WireGuard.
|
||||
* [Connect to OpenVPN](connect_to_openvpn_with_token.sh): This script allows you to connect to the VPN server via OpenVPN.
|
||||
* [Enable Port Forwarding](port_forwarding.sh): Enables you to add Port Forwarding to an existing VPN connection. Adding the environment variable `PIA_PF=true` to any of the previous scripts will also trigger this script.
|
||||
|
|
|
@ -64,7 +64,6 @@ fi
|
|||
|
||||
dipSavedLocation=/opt/piavpn-manual/dipAddress
|
||||
|
||||
echo
|
||||
echo -n "Checking DIP token..."
|
||||
|
||||
generateDIPResponse=$(curl -s --location --request POST \
|
||||
|
|
29
run_setup.sh
29
run_setup.sh
|
@ -117,11 +117,24 @@ while :; do
|
|||
fi
|
||||
done
|
||||
|
||||
# Check for in-line definition of $DIP_TOKEN
|
||||
if [[ -z $DIP_TOKEN ]]; then
|
||||
# Check for dedicated IP
|
||||
echo -n "Do you want to use a dedicated IP token ([N]o/[y]es): "
|
||||
read useDIP
|
||||
echo
|
||||
pfOption="true"
|
||||
else
|
||||
if echo ${DIP_TOKEN:0:1} | grep -iq n; then
|
||||
useDIP="no"
|
||||
echo -e "${red}Not using a dedicated IP.${nc}"
|
||||
echo
|
||||
DIP_TOKEN=""
|
||||
else
|
||||
useDIP="yes"
|
||||
fi
|
||||
fi
|
||||
|
||||
if echo ${useDIP:0:1} | grep -iq y; then
|
||||
useDIP="true"
|
||||
while :; do
|
||||
|
@ -130,8 +143,7 @@ useDIP="true"
|
|||
if [[ -z $DIP_TOKEN ]]; then
|
||||
read -p "Dedicated token (DIP#############################): " DIP_TOKEN
|
||||
fi
|
||||
|
||||
# Confirm format of PIA_USER input
|
||||
# Confirm format of DIP_TOKEN input
|
||||
dipPrefix=$( echo ${DIP_TOKEN:0:3} )
|
||||
if [[ -z "$DIP_TOKEN" ]]; then
|
||||
echo -e "\n${red}You must provide input.${nc}"
|
||||
|
@ -142,17 +154,17 @@ useDIP="true"
|
|||
else
|
||||
break
|
||||
fi
|
||||
echo
|
||||
DIP_TOKEN=""
|
||||
done
|
||||
export DIP_TOKEN
|
||||
|
||||
# Confirm DIP_TOKEN and retrieve connection details
|
||||
./get_dip.sh
|
||||
|
||||
dipDetails="/opt/piavpn-manual/dipAddress"
|
||||
# If the script failed to generate retrieve dedicated IP information, the script will exit early.
|
||||
if [ ! -f "$dipDetails" ]; then
|
||||
read -p "Do you want to try again ([N]o/[y]es): " tryAgain
|
||||
echo
|
||||
if ! echo ${tryAgain:0:1} | grep -iq y; then
|
||||
exit 1
|
||||
fi
|
||||
|
@ -168,6 +180,13 @@ useDIP="true"
|
|||
done
|
||||
fi
|
||||
|
||||
if [[ -z $DIP_TOKEN ]]; then
|
||||
echo "${green}DIP_TOKEN=none${nc}"
|
||||
else
|
||||
echo "${green}DIP_TOKEN=$DIP_TOKEN${nc}"
|
||||
fi
|
||||
echo
|
||||
|
||||
# Erase previous connection details if present
|
||||
rm -f /opt/piavpn-manual/token /opt/piavpn-manual/latencyList
|
||||
|
||||
|
@ -328,7 +347,7 @@ if [[ -z $DIP_TOKEN ]]; then
|
|||
location3=$( awk 'NR == '$i' {print $6}' /opt/piavpn-manual/latencyList )
|
||||
location4=$( awk 'NR == '$i' {print $7}' /opt/piavpn-manual/latencyList )
|
||||
location="$location1 $location2 $location3 $location4"
|
||||
printf "%3s : %-8s %-15s %17s" $i "$time" "$ip" "$id"
|
||||
printf "%3s : %-8s %-15s %23s" $i "$time" "$ip" "$id"
|
||||
echo " - $location"
|
||||
done < /opt/piavpn-manual/latencyList
|
||||
echo
|
||||
|
|
Loading…
Reference in New Issue
Block a user