Added port forwarding, fixes #14

This commit is contained in:
Quentin McGaw
2019-06-26 17:24:10 +02:00
parent fc177675ad
commit 62f4cc56b4
3 changed files with 26 additions and 3 deletions

11
portforward.sh Normal file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
client_id=`head -n 100 /dev/urandom | sha256sum | tr -d " -"`
json=`wget -qO- "http://209.222.18.222:2000/?client_id=$client_id" 2>/dev/null`
if [ "$json" == "" ]; then
printf "Port forwarding is already activated on this connection, has expired, or you are not connected to a PIA region that supports port forwarding\n"
exit 1
fi
port=`echo $json | grep -Eo [0-9]{3,5}`
ip=`wget -qO- https://diagnostic.opendns.com/myip`
printf "Forwarded port for IP $ip is: $port\n"