Default container VPN binding

This commit is contained in:
Alexandre
2025-11-25 10:27:47 +01:00
parent 51fd1a7404
commit fa45da21a3
5 changed files with 41 additions and 13 deletions

View File

@@ -129,17 +129,28 @@ if bashio::config.true 'openvpn_enabled'; then
vpn_openvpn=true
fi
if [[ "${vpn_openvpn}" == true ]] && ! bashio::config.true 'openvpn_alt_mode'; then
VPN_INTERFACE="tun0"
bashio::log.info "VPN monitor set to query external IP through interface ${VPN_INTERFACE} (interface binding)."
else
VPN_INTERFACE=""
fi
if bashio::config.true 'wireguard_enabled'; then
vpn_wireguard=true
fi
if ! bashio::config.true 'openvpn_alt_mode'; then
if [[ "${vpn_openvpn}" == true ]]; then
VPN_INTERFACE="tun0"
bashio::log.info "VPN monitor set to query external IP through interface ${VPN_INTERFACE} (interface binding)."
elif [[ "${vpn_wireguard}" == true ]]; then
if [[ -f /var/run/wireguard/interface ]]; then
VPN_INTERFACE="$(cat /var/run/wireguard/interface)"
else
VPN_INTERFACE="wg0"
fi
bashio::log.info "VPN monitor set to query external IP through interface ${VPN_INTERFACE} (interface binding)."
else
VPN_INTERFACE=""
fi
else
VPN_INTERFACE=""
fi
if [[ "${vpn_openvpn}" != true && "${vpn_wireguard}" != true ]]; then
bashio::log.info "VPN leak monitor not started because no VPN is enabled."
exit 0