Update x-ui.sh

This commit is to correct the previous one, which cannot handle port range settings correctly.
This commit is contained in:
Gzngskxgr20 2024-04-23 01:14:31 +08:00 committed by GitHub
parent 06e58840e9
commit 24756231a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -620,7 +620,8 @@ open_ports() {
# Split the range into start and end ports
start_port=$(echo $port | cut -d'-' -f1)
end_port=$(echo $port | cut -d'-' -f2)
ufw allow $start_port:$end_port
ufw allow $start_port:$end_port/tcp
ufw allow $start_port:$end_port/udp
else
ufw allow "$port"
fi
@ -652,7 +653,8 @@ delete_ports() {
start_port=$(echo $port | cut -d'-' -f1)
end_port=$(echo $port | cut -d'-' -f2)
# Delete the port range
ufw delete allow $start_port:$end_port
ufw delete allow $start_port:$end_port/tcp
ufw delete allow $start_port:$end_port/udp
else
ufw delete allow "$port"
fi