feat: add UDP support to USER_PORTS (#1011)

Allow USER_PORTS entries in the form PORT or PORT/PROTO (tcp or udp). When the protocol is omitted, TCP is assumed for backward compatibility. This enables forwarding of UDP services when running the container in user‑mode networking.
This commit is contained in:
Kroese authored and GitHub committed 2025-09-17 21:49:20 +02:00
1 parent a7e229aaae
commit 57a902ad9f
1 file changed
+12 -1
+12 -1
View File
@@ -152,7 +152,18 @@ getUserPorts() {
list="${list%% }"
for port in $list; do
args+="hostfwd=tcp::$port-$VM_NET_IP:$port,"
proto="tcp"
num="$port"
if [[ "$port" == */udp ]]; then
proto="udp"
num="${port%/udp}"
elif [[ "$port" == */tcp ]]; then
proto="tcp"
num="${port%/tcp}"
fi
args+="hostfwd=$proto::$num-$VM_NET_IP:$num,"
done
echo "${args%?}"