Skip to content

Commit d959306

Browse files
authored
feat: listen on all interfaces, hotspot sharing for iOS/laptop (#483)
Closes #481. Default `listen_host` from 127.0.0.1 to 0.0.0.0 so Android-phone-as-tunnel + iPhone/laptop on same hotspot can use it as proxy. Old configs with explicit `127.0.0.1` honored (not overwritten). By @yyoyoian-pixel. Local verification: cargo test --lib 160/160 passing, both release builds clean.
2 parents 23911ae + ca171f7 commit d959306

3 files changed

Lines changed: 23 additions & 3 deletions

File tree

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,26 @@ More deployments = more total concurrency = lower per-session latency. Each batc
319319
}
320320
```
321321

322+
## Sharing via hotspot (Android → iOS / laptop)
323+
324+
The proxy listens on `0.0.0.0` by default, so any device on the same network can use it. This lets you share the tunnel from an Android phone to an iPhone, iPad, or laptop over hotspot:
325+
326+
1. **Android**: enable mobile hotspot + start the app
327+
2. **Other device**: connect to the Android hotspot WiFi
328+
3. **Configure proxy** on the other device:
329+
- **Server**: `192.168.43.1` (Android's default hotspot IP)
330+
- **Port**: `8080` (HTTP) or `1081` (SOCKS5)
331+
332+
### iOS setup
333+
Settings → WiFi → tap (i) on the hotspot network → Configure Proxy → Manual → Server `192.168.43.1`, Port `8080`.
334+
335+
For full device-wide coverage on iOS, use an app like [Shadowrocket](https://apps.apple.com/app/shadowrocket/id932747118) or [Potatso](https://apps.apple.com/app/potatso/id1239860606) — point it at the SOCKS5 proxy (`192.168.43.1:1081`) and it will route all traffic through the tunnel.
336+
337+
### macOS / Windows
338+
Set the system HTTP proxy to `192.168.43.1:8080` in network settings, or configure per-app SOCKS5 proxy to `192.168.43.1:1081`.
339+
340+
> **Note**: if `listen_host` is set to `127.0.0.1` in your config, change it to `0.0.0.0` to allow connections from other devices.
341+
322342
## Running on OpenWRT (or any musl distro)
323343

324344
The `*-linux-musl-*` archives ship a fully static CLI that runs on OpenWRT, Alpine, and any libc-less Linux userland. Put the binary on the router and start it as a service:

android/app/src/main/java/com/therealaleph/mhrv/ConfigStore.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ enum class Mode { APPS_SCRIPT, GOOGLE_ONLY, FULL }
7676
data class MhrvConfig(
7777
val mode: Mode = Mode.APPS_SCRIPT,
7878

79-
val listenHost: String = "127.0.0.1",
79+
val listenHost: String = "0.0.0.0",
8080
val listenPort: Int = 8080,
8181
val socks5Port: Int? = 1081,
8282

@@ -395,7 +395,7 @@ object ConfigStore {
395395
"full" -> Mode.FULL
396396
else -> Mode.APPS_SCRIPT
397397
},
398-
listenHost = obj.optString("listen_host", "127.0.0.1"),
398+
listenHost = obj.optString("listen_host", "0.0.0.0"),
399399
listenPort = obj.optInt("listen_port", 8080),
400400
socks5Port = obj.optInt("socks5_port", 1081).takeIf { it > 0 },
401401
appsScriptUrls = urls,

src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ fn default_front_domain() -> String {
266266
"www.google.com".into()
267267
}
268268
fn default_listen_host() -> String {
269-
"127.0.0.1".into()
269+
"0.0.0.0".into()
270270
}
271271
fn default_listen_port() -> u16 {
272272
8085

0 commit comments

Comments
 (0)