mirror of
https://github.com/hassio-addons/addon-wireguard.git
synced 2025-05-04 19:01:31 +00:00
🚑 Fixes CIDR for automated handling of AllowedIPs
This commit is contained in:
parent
a2ab6a1b45
commit
ba1f26a445
1 changed files with 8 additions and 4 deletions
|
@ -225,16 +225,20 @@ for peer in $(bashio::config 'peers|keys'); do
|
|||
|
||||
# Determine allowed IPs for server side config, by default use
|
||||
# peer defined addresses.
|
||||
allowed_ips="${addresses}"
|
||||
list=()
|
||||
if bashio::config.has_value "peers[${peer}].allowed_ips"; then
|
||||
# Use allowed IP's defined by the user.
|
||||
list=()
|
||||
for address in $(bashio::config "peers[${peer}].allowed_ips"); do
|
||||
[[ "${address}" == *"/"* ]] || address="${address}/24"
|
||||
[[ "${address}" == *"/"* ]] || address="${address}/32"
|
||||
list+=("${address}")
|
||||
done
|
||||
else
|
||||
for address in $(bashio::config "peers[${peer}].addresses"); do
|
||||
[[ "${address}" == *"/"* ]] || address="${address}/32"
|
||||
list+=("${address}")
|
||||
done
|
||||
allowed_ips=$(IFS=", "; echo "${list[*]}")
|
||||
fi
|
||||
allowed_ips=$(IFS=", "; echo "${list[*]}")
|
||||
|
||||
# Determine persistent keep alive
|
||||
keep_alive=25
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue