This commit is contained in:
fred 2023-05-06 03:10:12 +02:00
parent d9b86f3f0e
commit 28395c89f5
1 changed files with 5 additions and 5 deletions

View File

@ -65,11 +65,11 @@ while true; do
# EACH VISITOR RECEIVE COMMAND RESPONSE ON
## RANDOM PORT = RESPONSE SOCKET & IPNS SESSION TOKEN
if [[ ${isLAN} && ( $(which yunohost) || -s ~/.zen/♥Box ) ]]; then
PORT=$((PORT+1)) && [ ${PORT} -ge 45782 ] && PORT=45780 ## yunohost|♥Box : OPEN FIREWALL 1234 12345 45780 45781
else
[ ${PORT} -le 12345 ] && PORT=$((PORT+${RANDOM:0:2})) || PORT=$((PORT-${RANDOM:0:2}))
fi ## RANDOM PORT SWAPPINESS AVOIDING COLLISION
[ ${PORT} -le 12345 ] && PORT=$((PORT+${RANDOM:0:2})) || PORT=$((PORT-${RANDOM:0:2}))
## RANDOM PORT SWAPPINESS AVOIDING COLLISION
# ZIP
[[ ${zIP} ]] && PORT=$((PORT+1)) && [ ${PORT} -ge 45782 ] && PORT=45780 ## yunohost : OPEN FIREWALL 1234 12345 45780 45781
## CHECK PORT IS FREE & KILL OLD ONE
pidportinuse=$(ps axf --sort=+utime | grep -w "nc -l -p ${PORT}" | grep -v -E 'color=auto|grep' | awk '{gsub(/^ +| +$/,"")} {print $0}' | tail -n 1 | cut -d " " -f 1)