Update wireguard.sh

This commit is contained in:
Teddysun 2020-02-14 17:29:02 +09:00 committed by GitHub
parent e94384875c
commit e983894e93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -521,7 +521,7 @@ add_client() {
client_ipv6=(${client_ipv6[@]} ${tmp_ipv6})
done
# Sort array
client_ipv4_sorted=($(printf '%s\n' "${client_ipv4[@]}" | sort))
client_ipv4_sorted=($(printf '%s\n' "${client_ipv4[@]}" | sort -V))
index=$(expr ${#client_ipv4[@]} - 1)
last_ip=$(echo ${client_ipv4_sorted[$index]} | cut -d. -f4)
issue_ip_last=$(expr ${last_ip} + 1)