feat!: tun monitoring, move ping restarts to auto-tunnel w/recovery (#885)

This is a big one.. oops.

Main changes:
- Make ping monitor more robust and global, with ping target overrides of the default cloudflare fallback target per tunnel (for full tunnels, otherwise we ping the internal tun ip)
- Include ping restart recovery to prevent tun being down if dns failures happen after a bounce
- Ping monitoring itself remains per tunnel and works without auto tunnel active, but moves the restart feature back to be managed by and integrated with auto tunnel to prevent inconsistencies and conflicts
- Ping statistics can be optionally included to be displayed with tun statistics
- Adds the beginnings of monitoring logs for handshake and data packet failures for userspace tuns (to be incorporated with restarts/tun status later)
- Improve tun error notifications, adds ping restart notifications
- Major refactor of auto tunnel logic to make it more modular and extensible for new auto tunnel conditions
- A bunch of other stuff..
This commit is contained in:
Zane Schepke
2025-08-07 18:19:36 -04:00
committed by GitHub
parent 230cd0adb8
commit 38ecb0b66b
108 changed files with 2415 additions and 1308 deletions
@@ -3,17 +3,11 @@ package com.zaneschepke.logcatter
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.LifecycleOwner
import com.zaneschepke.logcatter.model.LogMessage
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.Job
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.cancel
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.BufferOverflow
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.launch
class LogcatManager(pid: Int, logDir: String, maxFileSize: Long, maxFolderSize: Long) :
LogReader, DefaultLifecycleObserver {