You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature/PR Proposal] Auto-pause proxy on trusted Wi-Fi (SSID) and auto-resume when leaving / 指定 Wi-Fi 自动暂停代理并在离开后自动恢复
#879
Before opening a PR, I'd like to check whether this feature aligns with CMFA's design goals and permission policy.
Motivation
Many users have a home/office router running a transparent proxy (e.g., OpenWrt/mihomo). When connecting to that Wi-Fi, running CMFA on the phone causes double-proxying; when leaving Wi-Fi, users have to manually re-enable CMFA.
While external automation tools (Tasker / MacroDroid / Samsung Routines + ExternalControlActivity) can work around this, not all devices have built-in routines, and third-party automation apps add extra setup complexity, permissions, and battery usage.
Opt-in & disabled by default: Adds a "Wi-Fi Auto Switch" section under Settings → Network with a toggle and a trusted SSID list (with a button to insert the current Wi-Fi SSID).
Zero-polling passive listener: Uses ConnectivityManager.NetworkCallback with brief join/leave debouncing (to avoid flapping during mesh/AP roaming).
Clean Pause ↔ Resume lifecycle:
When connected to a listed SSID, closes the TUN interface and resets the core (releasing VPN icon and traffic ticker), keeping only a silent standby notification.
When leaving the SSID, automatically re-establishes TUN and reloads the profile (avoiding Android 12+ background FGS start restrictions).
Manually stopping Clash exits the service completely and does not auto-resume.
Key Trade-off (Location Permission)
On Android, reading Wi-Fi SSID requires ACCESS_FINE_LOCATION (and optionally ACCESS_BACKGROUND_LOCATION on Android 10+ for screen-off/background switching). Permissions are only requested if the user explicitly enables this option.
Would you be open to accepting a PR for this feature, or do you prefer keeping CMFA strictly free of location permissions and delegating Wi-Fi triggers to external automation tools?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Hi maintainers,
Before opening a PR, I'd like to check whether this feature aligns with CMFA's design goals and permission policy.
Motivation
Many users have a home/office router running a transparent proxy (e.g., OpenWrt/mihomo). When connecting to that Wi-Fi, running CMFA on the phone causes double-proxying; when leaving Wi-Fi, users have to manually re-enable CMFA.
While external automation tools (Tasker / MacroDroid / Samsung Routines +
ExternalControlActivity) can work around this, not all devices have built-in routines, and third-party automation apps add extra setup complexity, permissions, and battery usage.Proposed Design (prototyped & tested locally, ~500 LOC)
ConnectivityManager.NetworkCallbackwith brief join/leave debouncing (to avoid flapping during mesh/AP roaming).Key Trade-off (Location Permission)
On Android, reading Wi-Fi SSID requires
ACCESS_FINE_LOCATION(and optionallyACCESS_BACKGROUND_LOCATIONon Android 10+ for screen-off/background switching). Permissions are only requested if the user explicitly enables this option.Would you be open to accepting a PR for this feature, or do you prefer keeping CMFA strictly free of location permissions and delegating Wi-Fi triggers to external automation tools?
中文说明
各位维护者好,在正式提交 PR 之前,想先确认这个功能是否符合 CMFA 的设计理念与权限策略。
动机
很多用户家里或办公室的路由器已经部署了透明代理(如 OpenWrt / mihomo)。手机连上这类 Wi-Fi 时如果继续开着 CMFA 会导致双重代理,而离开 Wi-Fi 后又需要手动重新开启代理。
虽然可以借助 Tasker / MacroDroid / 三星日常程序配合
ExternalControlActivity曲线实现,但并非所有系统都有自带自动化工具,引入第三方自动化软件也会增加配置成本、额外权限和耗电。设计方案(已在本地实现并实测通过,约 500 行代码)
ConnectivityManager.NetworkCallback,并对连入/离开做短暂防抖,避免家中 Mesh / 2.4G↔5G 漫游时反复开关。关键权衡(定位权限)
Android 读取 Wi-Fi SSID 需要声明
ACCESS_FINE_LOCATION(Android 10+ 若需息屏/后台自动切换,还需用户可选授予ACCESS_BACKGROUND_LOCATION),仅在用户手动开启该功能时才会请求权限。想请教维护者:是否接受这个方向的 PR?还是更倾向于让 CMFA 严格保持零定位权限、把 Wi-Fi 触发交给外部自动化工具?谢谢!
All reactions