Add an on-demand traffic monitor to the tray and Android
Show bidirectional IP conversations with network and peer names, ports, traffic roles, packet totals and directional rates. Aggregate ICMP echoes by address pair. Attribute exit requests and replies from each endpoint's perspective and match VIP traffic on the client-facing side of NAT. Keep authenticated control sessions and opaque relay pairs in a transport view. Each open window owns a bounded interval subscription. The idle path only checks whether a reader exists. Contended writers can use another lane, and observations lost under load are counted without delaying forwarding. Use a dedicated local control connection on desktop and a service handle on Android. Closing or backgrounding the Android screen releases capture. The local IPC format advances to 28. Existing mesh peers and databases remain compatible. Accumulate intervals off the render thread in a private temporary SQLite database. Expire inactive rows after a minute or retain them until close. Indexed, cursor-based pages keep long sessions out of UI memory. Closing the window interrupts pending queries and releases the scratch database. On macOS arm64, workspace formatting and strict Clippy passed. The locked all-targets workspace suite passed 641 tests with five opt-in tests ignored. Coverage includes real WireGuard exit traffic in both directions, local IPC lifetime, Android pause/resume, relay opacity, VIP translation, bounded capture, simulated three-day retention and 320–900 point layouts. The Windows GNU workspace cross-check and the offline Android arm64 debug APK build passed. Windows and Android hardware were not exercised.
This commit is contained in:
1 parent
7afed15f76
commit
e3b74babba
42 files changed
+2476
-31
No files matched your search
@@ -19,6 +19,7 @@ import javax.microedition.khronos.opengles.GL10
|
||||
class MeshSurface(private val activity: MainActivity) : GLSurfaceView(activity), GLSurfaceView.Renderer {
|
||||
private val density get() = resources.displayMetrics.density
|
||||
private val imm = activity.getSystemService(InputMethodManager::class.java)
|
||||
@Volatile private var paused = false
|
||||
private var imeMode = 0
|
||||
private var widthPx = 0
|
||||
private var heightPx = 0
|
||||
@@ -33,16 +34,23 @@ class MeshSurface(private val activity: MainActivity) : GLSurfaceView(activity),
|
||||
isFocusableInTouchMode = true
|
||||
requestFocus()
|
||||
}
|
||||
override fun onSurfaceCreated(gl: GL10?, config: EGLConfig?) = Native.surface()
|
||||
override fun onSurfaceCreated(gl: GL10?, config: EGLConfig?) = Native.surface(context.cacheDir.absolutePath)
|
||||
override fun onSurfaceChanged(gl: GL10?, w: Int, h: Int) { widthPx = w; heightPx = h }
|
||||
override fun onDrawFrame(gl: GL10?) {
|
||||
if (paused) return
|
||||
if (pickExit.getAndSet(false)) Native.input(6, "")
|
||||
val landscape = resources.configuration.orientation == android.content.res.Configuration.ORIENTATION_LANDSCAPE
|
||||
val delay = Native.draw(this, widthPx, heightPx, density, MeshVpn.started, landscape)
|
||||
removeCallbacks(repaint)
|
||||
postDelayed(repaint, delay.coerceAtLeast(16))
|
||||
}
|
||||
override fun onPause() { super.onPause(); removeCallbacks(repaint) }
|
||||
override fun onPause() {
|
||||
paused = true
|
||||
queueEvent { Native.pauseTraffic() }
|
||||
super.onPause()
|
||||
removeCallbacks(repaint)
|
||||
}
|
||||
override fun onResume() { paused = false; super.onResume(); requestRender() }
|
||||
override fun onTouchEvent(e: MotionEvent): Boolean {
|
||||
val phase = when (e.actionMasked) {
|
||||
MotionEvent.ACTION_DOWN, MotionEvent.ACTION_POINTER_DOWN -> 0
|
||||
|
||||
@@ -14,7 +14,8 @@ internal object Native {
|
||||
external fun networkChanged(instance: Long, addresses: String)
|
||||
external fun setMetered(instance: Long, metered: Boolean)
|
||||
|
||||
external fun surface()
|
||||
external fun surface(cacheDir: String)
|
||||
external fun pauseTraffic()
|
||||
external fun draw(host: MeshSurface, width: Int, height: Int, density: Float, serviceStarted: Boolean, landscape: Boolean): Long
|
||||
external fun touch(action: Int, id: Int, x: Float, y: Float)
|
||||
external fun input(kind: Int, value: String)
|
||||
|
||||
Reference in new issue
Block a user