-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from ReidE96/viscosity
Added support for Viscosity
- Loading branch information
Showing
7 changed files
with
43 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
INSTANCE_TYPE="g2.2xlarge" | ||
SPOT_PRICE_BUFFER="0.10" | ||
VPN_CLIENT="tunnelblick" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
tell application "Viscosity" | ||
disconnect (connections where name is "ec2gaming") | ||
set currentState to state of connections where name is "ec2gaming" | ||
repeat until currentState = "Disconnected" | ||
delay 1 | ||
set currentState to state of connections where name is "ec2gaming" | ||
set currentState to currentState as string | ||
end repeat | ||
end tell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,32 @@ | ||
#!/usr/bin/env bash | ||
source "$(dirname "$0")/ec2gaming.header" | ||
|
||
echo -n "Connecting VPN (you may see an authentication prompt)... " | ||
echo "Connecting VPN (you may see an authentication prompt)... " | ||
IP=$(./ec2gaming-ip.sh) | ||
AUTH=$(realpath "$(pwd)/../ec2gaming.auth") | ||
BACKING_CONFIG=~/Library/Application\ Support/Tunnelblick/Configurations/ec2gaming.tblk/Contents/Resources/config.ovpn | ||
if [ ! -f "$BACKING_CONFIG" ]; then | ||
CONFIG_EXISTS=0 | ||
|
||
# Find if config exists | ||
if [ "$VPN_CLIENT" = "tunnelblick" ]; then | ||
BACKING_CONFIG=~/Library/Application\ Support/Tunnelblick/Configurations/ec2gaming.tblk/Contents/Resources/config.ovpn | ||
if [ -f "$BACKING_CONFIG" ]; then | ||
CONFIG_EXISTS=1 | ||
# the authentication prompt on copy will block, avoids the messy sleep | ||
sed "s#IP#$IP#g;s#AUTH#$AUTH#g" ec2gaming.ovpn.template > "$BACKING_CONFIG" | ||
fi | ||
elif [ "$VPN_CLIENT" = "viscosity" ]; then | ||
grep -R ec2gaming ~/Library/Application\ Support/Viscosity/OpenVPN > /dev/null | ||
if [ $? -eq 0 ]; then | ||
CONFIG_EXISTS=1 | ||
fi | ||
fi | ||
|
||
# Create config if needed | ||
if [ $CONFIG_EXISTS -eq 0 ]; then | ||
sed "s#IP#$IP#g;s#AUTH#$AUTH#g" ec2gaming.ovpn.template > ec2gaming.ovpn | ||
open ec2gaming.ovpn | ||
echo "Waiting 10 seconds for import..." | ||
sleep 10 | ||
else | ||
# the authentication prompt on copy will block, avoids the messy sleep | ||
sed "s#IP#$IP#g;s#AUTH#$AUTH#g" ec2gaming.ovpn.template > "$BACKING_CONFIG" | ||
fi | ||
|
||
osascript ec2gaming-vpnup.scpt | ||
osascript "ec2gaming-vpnup.$VPN_CLIENT.scpt" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
tell application "Viscosity" | ||
set currentState to "Unknown" | ||
repeat until (currentState = "Connected") | ||
if currentState = "Disconnected" then | ||
connect (connections where name is "ec2gaming") | ||
end if | ||
set currentState to state of connections where name is "ec2gaming" | ||
set currentState to currentState as string | ||
delay 1 | ||
end repeat | ||
end tell |