3.6 KiB
RKNnoVPN Module Ownership
This module is split by root-runtime responsibility, not by historical script entrypoint.
Entry Points
customize.shinstalls files, preserves user config, records the release catalog, and disables autostart until the app starts the runtime.post-fs-data.shis early boot only: create the data skeleton, apply basic permissions, and set kernel toggles. It must not clean runtime markers.service.shis late boot only: wait for boot completion, askrknnovpn_env.shwhether boot cleanup markers exist, run canonical boot cleanup, and launchdaemon. It must not implement its own stale process/socket/PID cleanup.scripts/rescue_reset.shis the canonical root cleanup API.uninstall.shdelegates runtime cleanup toscripts/rescue_reset.shand only handles uninstall-specific preservation/restoration.
Shared Runtime Library
Module scripts should use the shared files under scripts/lib/:
rknnovpn_env.showns canonical paths, marker helpers, and shared permission/layout helpers.rknnovpn_install.showns install/release-catalog helper behavior shared by Magisk/KSU/APatch installation and staged module updates.rknnovpn_installer_flow.showns the Magisk/KSU/APatch install flow: preflight, config preservation, binary/script copy, release catalog, and permissions.customize.shmust stay a thin entrypoint.rknnovpn_netstack.showns generic RKNnoVPN netfilter/policy-routing cleanup helpers used by rescue/uninstall paths.rknnovpn_iptables_rules.showns TPROXY rule rendering and listener protection verification.scripts/iptables.shmust stay orchestration: validate env, snapshot, apply, teardown, and status dispatch.
Both Magisk/KSU/APatch installation (customize.sh) and the daemon hot-update
installer must treat all scripts/lib/*.sh files as required module files.
The library owns these path names:
RKNNOVPN_DIR=/data/adb/modules/rknnovpnBIN_DIR,CONFIG_DIR,SCRIPTS_DIR,RUN_DIR,LOG_DIRRESET_LOCK,ACTIVE_FILE,MANUAL_FLAGDAEMON_PID_FILE,SINGBOX_PID_FILE,DAEMON_SOCK
Marker Ownership
-
run/reset.lock- Created by
rescue_reset.shwhen entering reset/cleanup mode. - Removed by
rescue_reset.shafterboot-clean,hard-reset, oruninstall-clean. - Preserved after
daemon-resetso the daemon-owned reset window remains externally visible until daemon logic completes. - Must not be removed by
post-fs-data.shorservice.sh.
- Created by
-
config/manual- Created by installer and user-visible hard reset paths.
- Prevents boot/autostart from resurrecting proxy rules.
boot-cleananduninstall-cleanmust not create it.
-
run/active- Runtime liveness marker for network-change handling.
- Cleared when entering reset/manual mode.
- Must not be blindly removed by
post-fs-data.sh; boot cleanup decides whether stale active state needs root cleanup.
Cleanup Ownership
scripts/rescue_reset.sh is the only script that should implement complete
RKNnoVPN-owned cleanup of processes, DNS rules, iptables chains, policy
routing, and runtime snapshots.
Other entrypoints may call it, but should not grow a parallel netfilter cleanup
implementation. If rescue_reset.sh is missing, entrypoints should report that
runtime cleanup is unavailable rather than partially reimplementing process,
marker, or netfilter cleanup.
Netstack Ownership
scripts/iptables.showns applying/removing mangle rules, policy routing, and runtime snapshots inrun/env.sh; rule text and listener verification belong inscripts/lib/rknnovpn_iptables_rules.sh.scripts/dns.showns classic DNS nat interception.