feat: add LAN mode - bind to 0.0.0.0 for sharing proxy across local network

Made-with: Cursor
This commit is contained in:
by-sonic
2026-04-08 15:00:22 +03:00
parent 70c61e1330
commit 6795c6177a
2 changed files with 41 additions and 6 deletions
+3 -2
View File
@@ -29,8 +29,9 @@ impl Stats {
}
}
pub async fn run(stats: Arc<Stats>) -> Result<(), String> {
let addr = format!("127.0.0.1:{}", PORT);
pub async fn run(stats: Arc<Stats>, lan: bool) -> Result<(), String> {
let host = if lan { "0.0.0.0" } else { "127.0.0.1" };
let addr = format!("{}:{}", host, PORT);
let listener = TcpListener::bind(&addr)
.await
.map_err(|e| format!("Port {} busy: {}", PORT, e))?;