Skip to content

Commit

Permalink
fix: Port forwarding (#530)
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Jan 3, 2024
1 parent d65b5a0 commit e70ed19
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions src/network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,34 +94,20 @@ configureDNS() {
getPorts() {

local list=$1
local args=""
local vnc="5900"

list="${list//,/ }"
list="${list## }"
list="${list%% }"

if [[ "${DISPLAY,,}" == "vnc" ]] && [[ "$list" != *"$vnc"* ]]; then
if [ -z "$list" ]; then
list="$vnc"
else
list="$list $vnc"
fi
[ -z "$list" ] && list="$vnc" || list="$list,$vnc"
fi

if [ -n "$list" ]; then
if [[ "$list" != *" "* ]]; then
args=" ! --dport $list"
else
args=" -m multiport ! --dports "
for port in $list; do
args="${args}${port},"
done
args="${args%?}"
fi
[ -z "$list" ] && return 0

if [[ "$list" != *","* ]]; then
echo " ! --dport $list"
else
echo " -m multiport ! --dports $list"
fi

echo "$args"
return 0
}

Expand Down

0 comments on commit e70ed19

Please sign in to comment.