Skip to content

Commit

Permalink
Show warning if port forwarding is unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
thrnz committed Nov 11, 2024
1 parent 44d9730 commit 2af177a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 7 additions & 3 deletions extra/wg-gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,13 @@ get_wgconf () {
echo "Using custom DNS servers: $dns"
fi

cat <<CONFF > "$wg_out"
#cn: $wg_cn
#pf api ip: $pfapi_ip
# Store the info needed for port forwarding as comments in the generated config for later use if needed
if [ "$port_forward_avail" -eq 1 ]; then
echo "#cn: $wg_cn" > "$wg_out"
echo "#pf api ip: $pfapi_ip" >> "$wg_out"
fi

cat <<CONFF >> "$wg_out"
[Interface]
PrivateKey = $client_private_key
Address = $peer_ip
Expand Down
2 changes: 2 additions & 0 deletions run
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ if [ $PORT_FORWARDING -eq 1 ] && [ -n "$pf_api_ip" ]; then
/scripts/pf.sh -t "$tokenfile" -i "$pf_api_ip" -n "$pf_cn" -p "$portfile" -c "$pia_cacrt" -s "/scripts/pf_success.sh" -f wg0 &
fi
pf_pid=$!
elif [ $PORT_FORWARDING -eq 1 ] && [ -z "$pf_api_ip" ]; then
echo "$(date): Warning: Port forwarding is unavailable on this server. Try a different location."
fi

[ -x "$post_up_script" ] && run_command "$post_up_script"
Expand Down

0 comments on commit 2af177a

Please sign in to comment.