diff --git a/netstack-smoltcp/src/tcp.rs b/netstack-smoltcp/src/tcp.rs index 1af8f36..fa2c66f 100644 --- a/netstack-smoltcp/src/tcp.rs +++ b/netstack-smoltcp/src/tcp.rs @@ -22,7 +22,7 @@ use spin::Mutex as SpinMutex; use tokio::{ io::{AsyncRead, AsyncWrite, ReadBuf}, sync::{ - mpsc::{channel, unbounded_channel, Receiver, Sender, UnboundedReceiver, UnboundedSender}, + mpsc::{channel, Receiver, Sender, UnboundedSender}, Notify, }, }; diff --git a/ostp-client/src/bridge.rs b/ostp-client/src/bridge.rs index a5a0565..98b2383 100644 --- a/ostp-client/src/bridge.rs +++ b/ostp-client/src/bridge.rs @@ -144,7 +144,8 @@ impl Bridge { if *shutdown.borrow() { self.running = false; self.metrics.connection_state.store(0, Ordering::Relaxed); - proxy_guard = None; + #[allow(unused_assignments)] + { proxy_guard = None; } stream_map.clear(); self.reset_proxy_streams(&tx, &proxy_tx, "manual stop"); break; @@ -195,7 +196,7 @@ impl Bridge { udp_msg: Option<(usize, Bytes)>, sessions_opt: &mut Option>, udp_rx_opt: &mut Option>, - proxy_guard: &mut Option, + _proxy_guard: &mut Option, stream_map: &mut std::collections::HashMap, tx: &mpsc::Sender, proxy_tx: &mpsc::UnboundedSender<(u16, ProxyToClientMsg)>, diff --git a/ostp-client/src/tunnel/proxy.rs b/ostp-client/src/tunnel/proxy.rs index c785782..e1634c9 100644 --- a/ostp-client/src/tunnel/proxy.rs +++ b/ostp-client/src/tunnel/proxy.rs @@ -520,7 +520,7 @@ fn spawn_direct_udp_reader( direct_socket: Arc, sock_tx: Arc, client_udp_addr: Arc>>, - debug: bool, + _debug: bool, ) { tokio::spawn(async move { let mut buf = vec![0u8; 65536]; @@ -880,7 +880,7 @@ async fn direct_connect_socks5( physical_if_index: Option, physical_if_name: &Option, close_tx: mpsc::Sender, - debug: bool, + _debug: bool, ) -> Result<()> { if true { tracing::info!("proxy BYPASS stream_id={stream_id} target={target}"); @@ -902,7 +902,7 @@ async fn direct_connect_http( physical_if_index: Option, physical_if_name: &Option, close_tx: mpsc::Sender, - debug: bool, + _debug: bool, ) -> Result<()> { if true { tracing::info!("proxy BYPASS stream_id={stream_id} target={target}"); diff --git a/ostp-client/src/tunnel/udp_nat.rs b/ostp-client/src/tunnel/udp_nat.rs index e478f6d..04c70e6 100644 --- a/ostp-client/src/tunnel/udp_nat.rs +++ b/ostp-client/src/tunnel/udp_nat.rs @@ -9,7 +9,7 @@ use futures::StreamExt; pub async fn run_udp_nat( udp_socket: netstack_smoltcp::UdpSocket, proxy_addr: String, - debug: bool, + _debug: bool, ) { let (mut rx, tx) = udp_socket.split(); let tx = Arc::new(Mutex::new(tx)); diff --git a/ostp-flutter/pubspec.yaml b/ostp-flutter/pubspec.yaml index ed16e0e..e396e88 100644 --- a/ostp-flutter/pubspec.yaml +++ b/ostp-flutter/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 0.2.90+5 +version: 0.2.92+7 environment: sdk: ^3.11.4 diff --git a/ostp-gui/src-tauri/tauri.conf.json b/ostp-gui/src-tauri/tauri.conf.json index 32dcb01..308bf8e 100644 --- a/ostp-gui/src-tauri/tauri.conf.json +++ b/ostp-gui/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "ostp-gui", - "version": "0.2.90", + "version": "0.2.92", "identifier": "com.ospab.ostp", "build": { "frontendDist": "../src" diff --git a/ostp-jni/src/lib.rs b/ostp-jni/src/lib.rs index 71a1dd3..8c2538b 100644 --- a/ostp-jni/src/lib.rs +++ b/ostp-jni/src/lib.rs @@ -3,7 +3,7 @@ use jni::sys::{jboolean, jstring}; use jni::JNIEnv; use std::collections::VecDeque; -use std::sync::{atomic::Ordering, Arc, Mutex, RwLock}; +use std::sync::{atomic::Ordering, Arc, RwLock}; use tokio::runtime::Runtime; use tokio::sync::{mpsc, watch}; use ostp_client::bridge::{Bridge, BridgeMetrics}; @@ -215,7 +215,7 @@ pub extern "system" fn Java_net_ostp_client_OstpClientSdk_nativeStartClient( // Create exclusions channel let (exclusions_tx, exclusions_rx) = watch::channel(config.exclusions.clone()); - let exclusions_rx_tun = exclusions_tx.subscribe(); + let _exclusions_rx_tun = exclusions_tx.subscribe(); let metrics_clone = Arc::clone(&metrics); diff --git a/ostp-server/src/api.rs b/ostp-server/src/api.rs index 4d09742..5d38ffd 100644 --- a/ostp-server/src/api.rs +++ b/ostp-server/src/api.rs @@ -970,6 +970,7 @@ async fn handle_put_rules( if !check_token(&state, &headers) { return api_unauthorized(); } // Update memory + #[allow(unused_assignments)] let mut updated_outbound = None; { let mut lock = state.router.outbound_cfg.write().unwrap(); diff --git a/ostp-server/src/dns.rs b/ostp-server/src/dns.rs index 3e18489..aee1b13 100644 --- a/ostp-server/src/dns.rs +++ b/ostp-server/src/dns.rs @@ -310,6 +310,7 @@ impl DnsServer { } } + #[allow(dead_code)] async fn log_query(&self, domain: String, client_ip: String, blocked: bool) { let mut log = self.query_log.lock().await; if log.len() >= 1000 { diff --git a/ostp-server/src/lib.rs b/ostp-server/src/lib.rs index 3601b49..072cd9b 100644 --- a/ostp-server/src/lib.rs +++ b/ostp-server/src/lib.rs @@ -143,6 +143,7 @@ pub async fn run_server( tracing::info!("Watching configuration file for hot-reload: {:?}", path_to_watch); let mut last_mtime = None; + let mut _updated_outbound: Option = None; loop { tokio::time::sleep(tokio::time::Duration::from_secs(5)).await; if let Ok(metadata) = std::fs::metadata(&path_to_watch) { @@ -373,7 +374,7 @@ async fn run_server_loop( for bind_addr in &bind_addrs { let addr = bind_addr.parse::().unwrap(); let tcp_map_clone = tcp_map.clone(); - let shared_keys_clone = shared_keys.clone(); + let _shared_keys_clone = shared_keys.clone(); let udp_tx_clone = udp_tx.clone(); tokio::spawn(async move { diff --git a/ostp-server/src/outbound.rs b/ostp-server/src/outbound.rs index 834973f..a68606b 100644 --- a/ostp-server/src/outbound.rs +++ b/ostp-server/src/outbound.rs @@ -119,7 +119,7 @@ fn match_domain_rule(host: &str, suffixes: &[String]) -> bool { }) } -async fn match_ip_rule(host: &str, port: u16, cidrs: &[String]) -> bool { +async fn match_ip_rule(host: &str, _port: u16, cidrs: &[String]) -> bool { if cidrs.is_empty() { return false; } diff --git a/ostp/src/main.rs b/ostp/src/main.rs index 57eda1e..c49e6e2 100644 --- a/ostp/src/main.rs +++ b/ostp/src/main.rs @@ -82,10 +82,6 @@ fn parse_ostp_link(link: &str) -> Result { let port = parsed.port().ok_or_else(|| anyhow!("Missing port in share link"))?; let server = format!("{host}:{port}"); let mut sni = String::new(); - let mut fp = String::new(); - let mut pbk = String::new(); - let mut sid = String::new(); - let mut spx = String::new(); let mut transport_mode = String::from("udp"); let mut tun_enabled = false; let mut tun_dns = None; @@ -94,10 +90,6 @@ fn parse_ostp_link(link: &str) -> Result { for (k, v) in parsed.query_pairs() { match &*k { "sni" => sni = v.into_owned(), - "fp" => fp = v.into_owned(), - "pbk" => pbk = v.into_owned(), - "sid" => sid = v.into_owned(), - "spx" => spx = v.into_owned(), "type" => transport_mode = v.into_owned(), "tun" => tun_enabled = v == "true", "dns" => tun_dns = Some(v.into_owned()), @@ -535,7 +527,7 @@ fn wizard_section(title: &str) { } fn wizard_save_config(config_path: &std::path::Path, json_value: &serde_json::Value) -> Result { - let mut current_path = config_path.to_path_buf(); + let current_path = config_path.to_path_buf(); // Attempt 1: write to requested path if let Some(parent) = current_path.parent() { @@ -625,10 +617,12 @@ fn run_setup_wizard(config_path: &std::path::Path) -> Result<()> { // Try import from link first let use_link = wizard_yn("Do you have a share link (ostp://...)?", false); let (server, access_key, sni, transport_mode) = if use_link { - let mut p = url.query_pairs(); - let sni = p.find(|(k, _)| k == "sni").map(|(_, v): (&str, std::borrow::Cow)| v.to_string()).unwrap_or_default(); - let tm = p.find(|(k, _)| k == "type").map(|(_, v): (&str, std::borrow::Cow)| v.to_string()).unwrap_or("udp".to_string()); - (url.host_str().unwrap().to_string() + ":" + &url.port().unwrap_or(50000).to_string(), url.username().to_string(), sni, tm) + let link_str = wizard_prompt("Paste link", ""); + let parsed = url::Url::parse(&link_str).unwrap(); + let mut p = parsed.query_pairs(); + let sni = p.find(|(k, _)| k == "sni").map(|(_, v)| v.to_string()).unwrap_or_default(); + let tm = p.find(|(k, _)| k == "type").map(|(_, v)| v.to_string()).unwrap_or("udp".to_string()); + (parsed.host_str().unwrap().to_string() + ":" + &parsed.port().unwrap_or(50000).to_string(), parsed.username().to_string(), sni, tm) } else { ("127.0.0.1:50000".to_string(), "".to_string(), "".to_string(), "udp".to_string()) }; @@ -681,9 +675,9 @@ fn run_setup_wizard(config_path: &std::path::Path) -> Result<()> { } // Build and save config - let key_for_gen = generate_secure_key("hex"); // unused but needed for init template - let effective_sni = sni; + let key_for_gen = generate_secure_key("hex"); let _ = key_for_gen; + let _ = &sni; let client_json = serde_json::json!({ "mode": "client", @@ -1367,7 +1361,7 @@ async fn run_app() -> Result<()> { "sessions": 1 }}, "debug": false -}}"#, key, pub_key, sid) +}}"#, key) }; if let Some(parent) = args.config.parent() { if !parent.as_os_str().is_empty() { @@ -1383,16 +1377,14 @@ async fn run_app() -> Result<()> { if let AppMode::Server(s) = &config.mode { let key = &s.access_keys[0]; let host = get_or_ask_public_ip(&args.config); - let mut link = format!("ostp://{}@{}:50000", key.key(), host); - let mut query_params = Vec::new(); - + let mut query_params = Vec::::new(); query_params.push("type=udp".to_string()); - } + let mut link = format!("ostp://{}@{}:50000", key.key(), host); if !query_params.is_empty() { link.push('?'); link.push_str(&query_params.join("&")); - + } println!("\n Share link for client distribution:"); println!(" {}", link); } @@ -1436,18 +1428,14 @@ async fn run_app() -> Result<()> { println!("\n Client share links from {:?}:", args.config); for (idx, key) in server_cfg.access_keys.iter().enumerate() { - let mut link = format!("ostp://{}@{}:{}", key.key(), host, port); - let mut query_params = Vec::new(); - + let mut query_params = Vec::::new(); query_params.push("type=udp".to_string()); - } - - + let mut link = format!("ostp://{}@{}:{}", key.key(), host, port); if !query_params.is_empty() { link.push('?'); link.push_str(&query_params.join("&")); - + } println!(" [{}] {}", idx + 1, link); } return Ok(());