diff --git a/wireguard/config.json b/wireguard/config.json index 9aa6317..2877659 100755 --- a/wireguard/config.json +++ b/wireguard/config.json @@ -36,8 +36,8 @@ "10.10.0.1/16" ], "dns": [ - "8.8.8.8", - "8.8.4.4" + "1.1.1.1", + "9.9.9.9" ] }, "peers": [ @@ -58,7 +58,9 @@ "host": "str", "addresses": ["str"], "dns": ["str"], - "private_key": "str?" + "private_key": "str?", + "post_up": "str?", + "post_down": "str?" }, "peers": [ { diff --git a/wireguard/rootfs/etc/cont-init.d/config.sh b/wireguard/rootfs/etc/cont-init.d/config.sh index d62c662..55b0e2b 100644 --- a/wireguard/rootfs/etc/cont-init.d/config.sh +++ b/wireguard/rootfs/etc/cont-init.d/config.sh @@ -16,6 +16,8 @@ declare port declare pre_shared_key declare private_key declare public_key +declare post_up +declare post_down if ! bashio::fs.directory_exists '/ssl/wireguard'; then mkdir -p /ssl/wireguard || @@ -24,6 +26,11 @@ fi echo "[Interface]" > "${CONFIG}" +# Check if at least 1 address is specified +if ! bashio::config.has_value 'server.addresses'; then + bashio::exit.nok 'You need at least 1 address configured for the server' +fi + # Add all server addresses to the configuration for address in $(bashio::config 'server.addresses'); do echo "Address = ${address}" >> "${CONFIG}" @@ -46,12 +53,46 @@ else private_key=$(> "${CONFIG}"