Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2024-01-10 06:04:59 +03:00
parent e27df50ee3
commit 15bad014b4

View File

@ -1,19 +1,19 @@
#!/usr/bin/bash
CLIENT_IPS=${CLIENT_IPS}
BASE_IP=${CLIENT_IPS/0\/*}
IPs=($(cat /etc/wireguard/clients/* \
| grep Address \
| cut -d'.' -f 4 \
| cut -d '/' -f 1 \
| sort))
IPs=${IPs[@]}
i=1
while [ "$( echo $IPs | fgrep -w $i )" ] ; do
i=$(( i + 1 ))
done
echo $BASE_IP.$i
#!/usr/bin/bash
CLIENT_IPS=${CLIENT_IPS}
BASE_IP=${CLIENT_IPS/0\/*}
IPs=($(cat /etc/wireguard/clients/* \
| grep Address \
| cut -d'.' -f 4 \
| cut -d '/' -f 1 \
| sort))
IPs=${IPs[@]}
i=1
while [ "$( echo $IPs | fgrep -w $i )" ] ; do
i=$(( i + 1 ))
done
echo $BASE_IP.$i