Skip to content

Commit 2c8fcc7

Browse files
therealalephclaude
andcommitted
v1.6.3: fix Android notification SOCKS5 port mismatch (#211)
buildNotif() hardcoded `proxyPort + 1` for the SOCKS5 line, ignoring cfg.socks5Port entirely. With the default Android config (listenPort=8080, socks5Port=1081) the foreground notification read "Routing via SOCKS5 127.0.0.1:8081" but the real listener was on 1081 — so users configuring per-app SOCKS5 (Telegram, etc.) against the notification value silently failed. Use the same `cfg.socks5Port ?: (cfg.listenPort + 1)` elvis fallback the real listener uses, and surface both ports in the notification: HTTP 127.0.0.1:8080 · SOCKS5 127.0.0.1:1081 Reported by vpnineh and l3est (with netstat screenshots showing the exact mismatch). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3f014b0 commit 2c8fcc7

5 files changed

Lines changed: 21 additions & 7 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mhrv-rs"
3-
version = "1.6.2"
3+
version = "1.6.3"
44
edition = "2021"
55
description = "Rust port of MasterHttpRelayVPN -- DPI bypass via Google Apps Script relay with domain fronting"
66
license = "MIT"

android/app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ android {
1414
applicationId = "com.therealaleph.mhrv"
1515
minSdk = 24 // Android 7.0 — covers 99%+ of live devices.
1616
targetSdk = 34
17-
versionCode = 141
18-
versionName = "1.6.2"
17+
versionCode = 142
18+
versionName = "1.6.3"
1919

2020
// Ship all four mainstream Android ABIs:
2121
// - arm64-v8a — 95%+ of real-world Android phones since 2019

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,17 @@ class MhrvVpnService : VpnService() {
9191
// path below MUST therefore happen after a `startForeground()`
9292
// call — otherwise the user-visible symptom is "the app crashes
9393
// the instant I tap Start". See issue #73.
94-
startForeground(NOTIF_ID, buildNotif(cfg.listenPort))
94+
// Issue #211: notification used to display
95+
// `127.0.0.1:${listenPort + 1}` for the SOCKS5 port, which is
96+
// wrong whenever socks5Port doesn't equal listenPort+1. With the
97+
// default Android config (listenPort=8080, socks5Port=1081)
98+
// users saw "Routing via SOCKS5 127.0.0.1:8081" but the real
99+
// listener was on 1081 — so per-app SOCKS5 setup against the
100+
// notification value silently failed. Pass the actual socks5Port
101+
// (after the same elvis fallback used elsewhere) so the
102+
// notification matches reality.
103+
val notifSocks5Port = cfg.socks5Port ?: (cfg.listenPort + 1)
104+
startForeground(NOTIF_ID, buildNotif(cfg.listenPort, notifSocks5Port))
95105

96106
// Deployment ID + auth key are required for apps_script and full
97107
// modes — both talk to Apps Script. Only google_only (bootstrap)
@@ -424,7 +434,7 @@ class MhrvVpnService : VpnService() {
424434
Log.i(TAG, "onDestroy done")
425435
}
426436

427-
private fun buildNotif(proxyPort: Int): Notification {
437+
private fun buildNotif(httpPort: Int, socks5Port: Int): Notification {
428438
val mgr = getSystemService(NotificationManager::class.java)
429439
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
430440
val ch = NotificationChannel(
@@ -451,7 +461,7 @@ class MhrvVpnService : VpnService() {
451461
)
452462
return NotificationCompat.Builder(this, CHANNEL_ID)
453463
.setContentTitle("mhrv-rs VPN is active")
454-
.setContentText("Routing via SOCKS5 127.0.0.1:${proxyPort + 1}")
464+
.setContentText("HTTP 127.0.0.1:$httpPort · SOCKS5 127.0.0.1:$socks5Port")
455465
.setSmallIcon(android.R.drawable.presence_online)
456466
.setContentIntent(openIntent)
457467
.addAction(android.R.drawable.ic_menu_close_clear_cancel, "Stop", stopIntent)

docs/changelog/v1.6.3.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<!-- see docs/changelog/v1.1.0.md for the file format: Persian, then `---`, then English. -->
2+
• رفع باگ "نوتیفیکیشن سرور اندروید پورت اشتباه SOCKS5 رو نشون می‌داد" ([#211](https://github.com/therealaleph/MasterHttpRelayVPN-RUST/issues/211)): با تنظیمات پیش‌فرض اندروید (`listenPort=8080`, `socks5Port=1081`)، نوتیفیکیشن می‌نوشت `Routing via SOCKS5 127.0.0.1:8081` که اشتباه بود — listener واقعی روی `1081` اجرا می‌شد. هر کاربری که پروکسی تلگرام رو روی پورت نوتیفیکیشن (8081) ست می‌کرد، در سکوت fail می‌شد. علت: تابع `buildNotif` به‌جای خوندن `cfg.socks5Port`، hardcode می‌کرد `proxyPort + 1`. حالا متن نوتیفیکیشن همون منطق elvis fallback `cfg.socks5Port ?: (cfg.listenPort + 1)` رو که در تنظیم listener واقعی استفاده می‌شه می‌خونه و علاوه بر SOCKS5، پورت HTTP رو هم نشون می‌ده: `HTTP 127.0.0.1:8080 · SOCKS5 127.0.0.1:1081`. ۲ کاربر مستقل ریپورت کردن (vpnineh، l3est)
3+
---
4+
• Fix "Android server notification showed wrong SOCKS5 port" bug ([#211](https://github.com/therealaleph/MasterHttpRelayVPN-RUST/issues/211)): with the default Android config (`listenPort=8080`, `socks5Port=1081`), the foreground-service notification read `Routing via SOCKS5 127.0.0.1:8081` — wrong, since the real listener was on `1081`. Anyone configuring Telegram (or any per-app SOCKS5 client) against the notification value silently failed. Cause: `buildNotif` hardcoded `proxyPort + 1` instead of reading `cfg.socks5Port`. The notification now uses the same elvis fallback `cfg.socks5Port ?: (cfg.listenPort + 1)` that the actual listener uses, and shows both ports for clarity: `HTTP 127.0.0.1:8080 · SOCKS5 127.0.0.1:1081`. Two independent users (vpnineh, l3est) reported this

0 commit comments

Comments
 (0)