Skip to content

Commit

Permalink
include socks support
Browse files Browse the repository at this point in the history
  • Loading branch information
binhex committed Jun 28, 2024
1 parent 6b27624 commit bdb8fe1
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions run/nobody/watchdog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,44 @@ while true; do

fi

if [[ "${ENABLE_SOCKS}" == "yes" ]]; then

# get current bind ip for microsocks, if different to vpn_ip then kill
microsocks_current_bind_ip=$(pgrep -fa 'microsocks' | grep -o -P -m 1 '(?<=-b\s)[\d\.]+')

if [[ "${microsocks_current_bind_ip}" != "${vpn_ip}" ]]; then

echo "[info] Restarting microsocks due to change in vpn ip..."
pkill -SIGTERM "microsocks"

# run script to start microsocks
source /home/nobody/microsocks.sh

else

# check if microsocks is running, if not then skip shutdown of process
if ! pgrep -fa "/usr/local/bin/microsocks" > /dev/null; then

echo "[info] microsocks not running"

else

# mark microsocks as running
microsocks_running="true"

fi

if [[ "${microsocks_running}" == "false" ]]; then

# run script to start microsocks
source /home/nobody/microsocks.sh

fi

fi

fi

if [[ "${VPN_PROV}" == "pia" || "${VPN_PROV}" == "protonvpn" ]]; then

# if vpn port is not an integer then dont change port
Expand Down Expand Up @@ -159,6 +197,20 @@ while true; do

fi

if [[ "${ENABLE_SOCKS}" == "yes" ]]; then

# check if microsocks is running, if not then start via microsocks.sh
if ! pgrep -fa "/usr/local/bin/microsocks" > /dev/null; then

echo "[info] microsocks not running"

# run script to start microsocks
source /home/nobody/microsocks.sh

fi

fi

fi

if [[ "${DEBUG}" == "true" && "${VPN_ENABLED}" == "yes" ]]; then
Expand Down

0 comments on commit bdb8fe1

Please sign in to comment.