diff --git a/README.md b/README.md index 68ec54b..7bc51e6 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,8 @@ bmstu-otp.sh status ``` На сервере BMSTU одна сессия на пользователя. `off` закрывает туннель в mihomo и не даёт -cron поднять его снова; трафик в сети BMSTU сразу получает отказ. mihomo не отправляет +cron поднять его снова; трафик в сети BMSTU идёт без туннеля (дома напрямую, на улице через +`OVPN-EXIT`) — публичные ресурсы открываются, внутренние (`172.x`) нет. mihomo не отправляет серверу EXIT, поэтому сервер держит старую сессию до своего `ping-restart` — до ~5 минут, потом можно подключаться с другого устройства. diff --git a/router/bmstu-otp.sh b/router/bmstu-otp.sh index ff9ef7b..d751804 100755 --- a/router/bmstu-otp.sh +++ b/router/bmstu-otp.sh @@ -13,7 +13,7 @@ # bmstu-otp.sh authfile print username/password lines (openvpn auth-user-pass file) # bmstu-otp.sh refresh regenerate provider with fresh OTP, reload, warm up # bmstu-otp.sh check warm-up test; refresh only if the tunnel is dead (cron) -# bmstu-otp.sh off close the tunnel and keep it closed (BMSTU traffic is rejected); +# bmstu-otp.sh off close the tunnel and keep it closed (BMSTU traffic goes without it); # frees the single server session for another client # (the server drops the old session after its ping-restart, up to ~5 min) # bmstu-otp.sh on allow the tunnel again and bring it up @@ -213,11 +213,12 @@ alive() { --data-urlencode "url=$CHECK_URL" --data-urlencode "timeout=$CHECK_TIMEOUT" >/dev/null 2>&1 } -# provider with a single reject proxy: the old tunnel gets closed with the -# outdated proxy, and BMSTU traffic fails fast instead of hanging +# provider with a single direct proxy: the old tunnel gets closed with the +# outdated proxy, and BMSTU traffic goes without it (public resources still +# open; on street the provider's dialer-proxy sends it through OVPN-EXIT) write_off_provider() { mkdir -p "$(dirname "$PROVIDER_FILE")" - printf '# bmstu-otp.sh off\nproxies:\n - name: %s-off\n type: reject\n' "$PROVIDER_NAME" > "$PROVIDER_FILE" + printf '# bmstu-otp.sh off\nproxies:\n - name: %s-off\n type: direct\n' "$PROVIDER_NAME" > "$PROVIDER_FILE" } refresh() { diff --git a/router/mihomo-kit.sh b/router/mihomo-kit.sh index a136f26..80a5510 100755 --- a/router/mihomo-kit.sh +++ b/router/mihomo-kit.sh @@ -678,6 +678,11 @@ cmd_update() { [ -d "$src/$d" ] && cp -r "$src/$d" "$KIT_DIR/$d" done rm -rf "$tmp" + # the rest runs from the new script: this one is the old version + exec sh "$KIT_DIR/router/mihomo-kit.sh" post-update +} + +cmd_post_update() { install_files cmd_build cur=$(uci -q get nikki.config.profile) @@ -690,6 +695,7 @@ case "${1:-}" in use) shift; cmd_use "$@" ;; setup) cmd_setup ;; update) cmd_update ;; + post-update) cmd_post_update ;; install) cmd_install ;; fix) cmd_fix ;; ts-login) shift; cmd_ts_login "$@" ;;