fix: Port forwarding (#298)

This commit is contained in:
Kroese 2024-01-03 14:04:04 +01:00 committed by GitHub
parent 8a1dd8d8c0
commit ba6429def3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -94,35 +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
}