From 479d1bdfca1fdb5472543fa12ab9bd696b8ecfcf Mon Sep 17 00:00:00 2001 From: Mygod Date: Wed, 26 Dec 2018 11:46:58 +0800 Subject: [PATCH] Add documentation for settings --- README.md | 46 +++++++++++++++++-- .../vpnhotspot/SettingsPreferenceFragment.kt | 2 +- .../vpnhotspot/net/wifi/WifiDoubleLock.kt | 2 +- mobile/src/main/res/values-zh-rCN/strings.xml | 7 +-- mobile/src/main/res/values/strings.xml | 5 +- mobile/src/main/res/xml/pref_settings.xml | 15 +++--- 6 files changed, 61 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 80ebb407..191685b0 100644 --- a/README.md +++ b/README.md @@ -29,14 +29,54 @@ I don't know about you but I can't get my stupid Windows 10 to work with now that they introduced this [Mobile hotspot](https://support.microsoft.com/en-us/help/4027762/windows-use-your-pc-as-a-mobile-hotspot). -This app is designed to do only minimal changes to your system, so there's almost no chance you will brick your device -and/or break your Internet using this app *under normal conditions*. However there's also absolutely no guarantee it -won't. +## Settings and How to Use Them + +Default settings are picked to suit general use cases and maximize compatibility but it might not be optimal for battery + life. + +### Upstream + +* Upstream network interface: Main upstream used to reroute traffic. Leave blank for auto detect system VPN. + Put `none` (or other similarly invalid entries) to suppress tethering VPN. + Put your interface name for tethering WireGuard. +* Fallback upstream: Fallback upstream is used when some VPN leave certain routes fallback to default network interface. + Leave blank for auto detect. Put `none` (or other similarly invalid entries) to forbid falling back. + Put other interface name if you feel like it. +* IP Masquerade: Source address/port from downstream packets will be remapped. Leave on if you don't know what it does. + I find turning this option off sometimes works better for dummy VPNs like ad-blockers and socksifiers (like + Shadowsocks). But you should never turn it off for real VPNs like OpenVPN, WireGuard, etc. + +### Downstream + +* Disable IPv6 tethering: Turning this option on will disable IPv6 for system tethering. Useful for stopping IPv6 leaks + as this app currently doesn't handle IPv6 VPN tethering (see [#6](https://github.com/Mygod/VPNHotspot/issues/6)). +* Fallback DNS server[:port]: Only used when a DNS server isn't found on the upstream interface. +* Enable DHCP workaround: Only used if your device isn't able to get your clients IP addresses with VPN on. + +### Misc + +* Keep Wi-Fi alive: Acquire Wi-Fi locks when repeater, temporary hotspot or system VPN hotspot is activated. + - Choose "System default" to save battery life; + - Choose "On" (default) if repeater/hotspot turns itself off automatically or stops working after a while; + - Choose "High Performance Mode" to minimize packet loss and latency (will consume more power). +* Start repeater on boot: Self explanatory. +* Network status monitor mode: This option controls how the app monitors connected devices as well as interface changes + (when custom upstream is used). + Requires restarting the app to take effects. (best way is to go to app info and force stop) + - Netlink monitor: Use Linux netlink mechanism, most battery efficient but may not work with SELinux enforcing mode. + Sometimes auto fallbacks to Netlink monitor with root and Poll. + - Netlink monitor with root: Same as above but runs netlink as root. This option works well with SELinux enforcing mode + but might still be bugged on devices heavily modified by OEM and/or carriers. Sometimes auto fallbacks to Poll. + - Poll: (default) Update network information manually every second. Least battery efficient but it should work on most + devices. Recommended to switch to other modes if possible. + ## Q & A Search the [issue tracker](https://github.com/Mygod/VPNHotspot/issues) for more. +### [What changes exactly can this app do to my system? (and how to revert them)](https://github.com/Mygod/VPNHotspot/issues/8#issuecomment-448529512) + ### Failed to create group due to internal error/repeater shuts down after a while? This could caused by the Wi-Fi channel you selected is no longer available, due to: diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/SettingsPreferenceFragment.kt b/mobile/src/main/java/be/mygod/vpnhotspot/SettingsPreferenceFragment.kt index e8fcfe74..5f6cfcc6 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/SettingsPreferenceFragment.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/SettingsPreferenceFragment.kt @@ -120,7 +120,7 @@ class SettingsPreferenceFragment : PreferenceFragmentCompat() { true } findPreference("misc.source").setOnPreferenceClickListener { - (activity as MainActivity).launchUrl("https://github.com/Mygod/VPNHotspot".toUri()) + (activity as MainActivity).launchUrl("https://github.com/Mygod/VPNHotspot/blob/master/README.md".toUri()) true } findPreference("misc.donate").setOnPreferenceClickListener { diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiDoubleLock.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiDoubleLock.kt index 8e8b112a..b1831503 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiDoubleLock.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/WifiDoubleLock.kt @@ -14,7 +14,7 @@ class WifiDoubleLock(lockType: Int) : AutoCloseable { companion object : SharedPreferences.OnSharedPreferenceChangeListener { private const val KEY = "service.wifiLock" private val lockType get() = - WifiDoubleLock.Mode.valueOf(app.pref.getString(KEY, WifiDoubleLock.Mode.None.toString()) ?: "").lockType + WifiDoubleLock.Mode.valueOf(app.pref.getString(KEY, WifiDoubleLock.Mode.Full.toString()) ?: "").lockType private val service by lazy { app.getSystemService()!! } private var referenceCount = 0 diff --git a/mobile/src/main/res/values-zh-rCN/strings.xml b/mobile/src/main/res/values-zh-rCN/strings.xml index ae3f7c11..39bea33e 100644 --- a/mobile/src/main/res/values-zh-rCN/strings.xml +++ b/mobile/src/main/res/values-zh-rCN/strings.xml @@ -82,7 +82,7 @@ Wi\u2011Fi 运行频段 (不稳定) "自动 (1\u201114 = 2.4GHz, 15\u2011165 = 5GHz)" 禁用 IPv6 共享 - 防止 IPv6 VPN 泄漏。 + 防止 VPN 通过 IPv6 泄漏。 开机自启动中继 保持 Wi\u2011Fi 开启 系统默认 @@ -102,10 +102,11 @@ 尝试修复 DHCP 如果设备无法获取 IP 地址,尝试打开这个选项。 杂项 + 帮助 导出调试信息 这种非常有用哇 - 查看 GitHub 上的源码 - Star, 提交 issues, 合作 + 项目首页 @ GitHub + 查看使用手册,star, 提交 issues, 合作 捐款 请给我钱 PayPal, Flattr 等其他方式… diff --git a/mobile/src/main/res/values/strings.xml b/mobile/src/main/res/values/strings.xml index b6733581..e1020148 100644 --- a/mobile/src/main/res/values/strings.xml +++ b/mobile/src/main/res/values/strings.xml @@ -111,10 +111,11 @@ Update changed settings to current active services. Can also fix rare race conditions. Misc + Help Export debug information Such useful very wow - View on GitHub - Star, submit issues and contribute + Project homepage at GitHub + Read manual, star, submit issues and contribute Donate I love money PayPal, Flattr, more… diff --git a/mobile/src/main/res/xml/pref_settings.xml b/mobile/src/main/res/xml/pref_settings.xml index 005400b7..15d1ccad 100644 --- a/mobile/src/main/res/xml/pref_settings.xml +++ b/mobile/src/main/res/xml/pref_settings.xml @@ -54,7 +54,7 @@ android:icon="@drawable/ic_device_wifi_lock" android:entries="@array/settings_service_wifi_lock" android:entryValues="@array/settings_service_wifi_lock_values" - android:defaultValue="None" + android:defaultValue="Full" android:summary="%s" android:title="@string/settings_service_wifi_lock"/> - + + +