Skip to content

Commit

Permalink
Update to use .env instead of vars.sh & remove sleep infinity
Browse files Browse the repository at this point in the history
  • Loading branch information
jay-to-the-dee committed Dec 31, 2018
1 parent cf183fd commit aa079af
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
vars.sh
.env
15 changes: 9 additions & 6 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@
# User greeting
echo "Welcome to Windscribe HTTP proxy!"
echo "WINDSCRIBE_COUNTRY set to: ${WINDSCRIBE_COUNTRY}"
echo "HOST_PORT set to: ${HOST_PORT}"

# For OpenVPN operation
mkdir -p /dev/net
mknod /dev/net/tun c 10 200

# Start windscribe service
/etc/init.d/windscribe-cli start #"Starting windscribe ... OK\n"
read WINDSCRIBE_PID < /etc/windscribe/windscribe.pid
echo "Windscribe service started on container PID ${WINDSCRIBE_PID}"

if [ -z "$WINDSCRIBE_USERNAME" ] || [ -z "$WINDSCRIBE_PASSWORD" ];
then
# Login interactively
# Login interactively (requires interactive shell)
windscribe login
else
# Simulate "interactive" login
Expand All @@ -31,12 +34,12 @@ fi
windscribe account

# Final config tweaks possible now logged in
windscribe firewall off #Null since IPTables is dummy
windscribe protocol tcp #May potentially work better over NAT
#windscribe firewall off #Proxy operation does not require this be disabled so we'll leave as is
windscribe protocol tcp #We switch this as it may potentially work better over some NAT configurations
windscribe connect ${WINDSCRIBE_COUNTRY}

# Start tinyproxy HTTP proxy service
/etc/init.d/tinyproxy start
echo "Starting HTTP proxy on host port ${HOST_PORT} (HOST_PORT)..."
# Wait for tinyproxy daemon (hopefully forever) else docker dies :(
/usr/sbin/tinyproxy -d

# Wait for ever else docker dies :(
sleep infinity
6 changes: 6 additions & 0 deletions env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
WINDSCRIBE_USERNAME= # Insert Windscribe account username here
WINDSCRIBE_PASSWORD= # Corresponding account password

#Optional
LOCAL_PORT= # Local port number to run HTTP proxy on (8888 is default)
WINDSCRIBE_COUNTRY= # Chnage VPN server country (Current location as determined by Windscribe is default)
4 changes: 2 additions & 2 deletions localproxy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

source ./vars.sh
export $(grep -v '^#' .env | xargs -d '\n')

IMAGE_NAME="dilks/windscribe-httpproxy"
DNS1="1.1.1.1"
Expand All @@ -11,7 +11,7 @@ docker run --rm -d \
--env WINDSCRIBE_COUNTRY="$WINDSCRIBE_COUNTRY" \
--env WINDSCRIBE_USERNAME \
--env WINDSCRIBE_PASSWORD \
-p $LOCAL_PORT:8888 \
-p $HOST_PORT:8888 \
--dns "${DNS1}" \
--dns "${DNS2}" \
"${IMAGE_NAME}"

0 comments on commit aa079af

Please sign in to comment.