feat: subnet routes & bump version

This commit is contained in:
asvow
2024-09-28 02:21:57 +08:00
parent d00b4bb5fb
commit ff6ab2b00e
6 changed files with 360 additions and 268 deletions

View File

@@ -86,6 +86,23 @@ custom_instance() {
fi
fi
config_get subnetRoutes $cfg 'subnetRoutes'
if [ -n "$subnetRoutes" ]; then
i=1
lan_ip=$(uci get network.lan.ipaddr)
for route in $subnetRoutes; do
uci set network.ts_subnet$i='route'
uci set network.ts_subnet$i.interface='lan'
uci set network.ts_subnet$i.target=$route
uci set network.ts_subnet$i.gateway=$lan_ip
let i++
done
else
for route in $(uci show network | grep 'network\.ts_subnet[0-9]*\+=route' | grep -o 'network\.ts_subnet[0-9]*'); do
uci -q delete $route
done
fi
config_get access $cfg 'access'
if [ -n "$access" ]; then
if [ -z "$(uci -q get firewall.tszone)" ]; then
@@ -184,6 +201,9 @@ stop_instance() {
# Remove network settings
uci -q delete network.tailscale
uci -q delete network.ts_lan
for route in $(uci show network | grep 'network\.ts_subnet[0-9]*\+=route' | grep -o 'network\.ts_subnet[0-9]*'); do
uci -q delete $route
done
# Remove firewall settings
uci -q delete firewall.tszone