Fix all compilation errors and suppress all warnings across workspace

This commit is contained in:
ospab 2026-06-13 02:30:57 +03:00
parent 91d73081eb
commit 9dd029ae52
14 changed files with 36 additions and 44 deletions

View File

@ -22,7 +22,7 @@ use spin::Mutex as SpinMutex;
use tokio::{ use tokio::{
io::{AsyncRead, AsyncWrite, ReadBuf}, io::{AsyncRead, AsyncWrite, ReadBuf},
sync::{ sync::{
mpsc::{channel, unbounded_channel, Receiver, Sender, UnboundedReceiver, UnboundedSender}, mpsc::{channel, Receiver, Sender, UnboundedSender},
Notify, Notify,
}, },
}; };

View File

@ -144,7 +144,8 @@ impl Bridge {
if *shutdown.borrow() { if *shutdown.borrow() {
self.running = false; self.running = false;
self.metrics.connection_state.store(0, Ordering::Relaxed); self.metrics.connection_state.store(0, Ordering::Relaxed);
proxy_guard = None; #[allow(unused_assignments)]
{ proxy_guard = None; }
stream_map.clear(); stream_map.clear();
self.reset_proxy_streams(&tx, &proxy_tx, "manual stop"); self.reset_proxy_streams(&tx, &proxy_tx, "manual stop");
break; break;
@ -195,7 +196,7 @@ impl Bridge {
udp_msg: Option<(usize, Bytes)>, udp_msg: Option<(usize, Bytes)>,
sessions_opt: &mut Option<Vec<SessionState>>, sessions_opt: &mut Option<Vec<SessionState>>,
udp_rx_opt: &mut Option<mpsc::Receiver<(usize, Bytes)>>, udp_rx_opt: &mut Option<mpsc::Receiver<(usize, Bytes)>>,
proxy_guard: &mut Option<crate::sysproxy::SystemProxyGuard>, _proxy_guard: &mut Option<crate::sysproxy::SystemProxyGuard>,
stream_map: &mut std::collections::HashMap<u16, usize>, stream_map: &mut std::collections::HashMap<u16, usize>,
tx: &mpsc::Sender<UiEvent>, tx: &mpsc::Sender<UiEvent>,
proxy_tx: &mpsc::UnboundedSender<(u16, ProxyToClientMsg)>, proxy_tx: &mpsc::UnboundedSender<(u16, ProxyToClientMsg)>,

View File

@ -520,7 +520,7 @@ fn spawn_direct_udp_reader(
direct_socket: Arc<UdpSocket>, direct_socket: Arc<UdpSocket>,
sock_tx: Arc<UdpSocket>, sock_tx: Arc<UdpSocket>,
client_udp_addr: Arc<std::sync::Mutex<Option<std::net::SocketAddr>>>, client_udp_addr: Arc<std::sync::Mutex<Option<std::net::SocketAddr>>>,
debug: bool, _debug: bool,
) { ) {
tokio::spawn(async move { tokio::spawn(async move {
let mut buf = vec![0u8; 65536]; let mut buf = vec![0u8; 65536];
@ -880,7 +880,7 @@ async fn direct_connect_socks5(
physical_if_index: Option<u32>, physical_if_index: Option<u32>,
physical_if_name: &Option<String>, physical_if_name: &Option<String>,
close_tx: mpsc::Sender<u16>, close_tx: mpsc::Sender<u16>,
debug: bool, _debug: bool,
) -> Result<()> { ) -> Result<()> {
if true { if true {
tracing::info!("proxy BYPASS stream_id={stream_id} target={target}"); tracing::info!("proxy BYPASS stream_id={stream_id} target={target}");
@ -902,7 +902,7 @@ async fn direct_connect_http(
physical_if_index: Option<u32>, physical_if_index: Option<u32>,
physical_if_name: &Option<String>, physical_if_name: &Option<String>,
close_tx: mpsc::Sender<u16>, close_tx: mpsc::Sender<u16>,
debug: bool, _debug: bool,
) -> Result<()> { ) -> Result<()> {
if true { if true {
tracing::info!("proxy BYPASS stream_id={stream_id} target={target}"); tracing::info!("proxy BYPASS stream_id={stream_id} target={target}");

View File

@ -9,7 +9,7 @@ use futures::StreamExt;
pub async fn run_udp_nat( pub async fn run_udp_nat(
udp_socket: netstack_smoltcp::UdpSocket, udp_socket: netstack_smoltcp::UdpSocket,
proxy_addr: String, proxy_addr: String,
debug: bool, _debug: bool,
) { ) {
let (mut rx, tx) = udp_socket.split(); let (mut rx, tx) = udp_socket.split();
let tx = Arc::new(Mutex::new(tx)); let tx = Arc::new(Mutex::new(tx));

View File

@ -1,12 +1,12 @@
{ {
"name": "ostp-control", "name": "ostp-control",
"version": "0.2.87", "version": "0.2.92",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "ostp-control", "name": "ostp-control",
"version": "0.2.87", "version": "0.2.92",
"dependencies": { "dependencies": {
"@types/qrcode": "^1.5.6", "@types/qrcode": "^1.5.6",
"clsx": "^2.1.1", "clsx": "^2.1.1",

View File

@ -1,7 +1,7 @@
{ {
"name": "ostp-control", "name": "ostp-control",
"private": true, "private": true,
"version": "0.2.87", "version": "0.2.92",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@ -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 # 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 # 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. # 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: environment:
sdk: ^3.11.4 sdk: ^3.11.4

View File

@ -1,7 +1,7 @@
{ {
"$schema": "https://schema.tauri.app/config/2", "$schema": "https://schema.tauri.app/config/2",
"productName": "ostp-gui", "productName": "ostp-gui",
"version": "0.2.90", "version": "0.2.92",
"identifier": "com.ospab.ostp", "identifier": "com.ospab.ostp",
"build": { "build": {
"frontendDist": "../src" "frontendDist": "../src"

View File

@ -3,7 +3,7 @@ use jni::sys::{jboolean, jstring};
use jni::JNIEnv; use jni::JNIEnv;
use std::collections::VecDeque; 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::runtime::Runtime;
use tokio::sync::{mpsc, watch}; use tokio::sync::{mpsc, watch};
use ostp_client::bridge::{Bridge, BridgeMetrics}; use ostp_client::bridge::{Bridge, BridgeMetrics};
@ -215,7 +215,7 @@ pub extern "system" fn Java_net_ostp_client_OstpClientSdk_nativeStartClient(
// Create exclusions channel // Create exclusions channel
let (exclusions_tx, exclusions_rx) = watch::channel(config.exclusions.clone()); 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); let metrics_clone = Arc::clone(&metrics);

View File

@ -970,6 +970,7 @@ async fn handle_put_rules(
if !check_token(&state, &headers) { return api_unauthorized(); } if !check_token(&state, &headers) { return api_unauthorized(); }
// Update memory // Update memory
#[allow(unused_assignments)]
let mut updated_outbound = None; let mut updated_outbound = None;
{ {
let mut lock = state.router.outbound_cfg.write().unwrap(); let mut lock = state.router.outbound_cfg.write().unwrap();

View File

@ -310,6 +310,7 @@ impl DnsServer {
} }
} }
#[allow(dead_code)]
async fn log_query(&self, domain: String, client_ip: String, blocked: bool) { async fn log_query(&self, domain: String, client_ip: String, blocked: bool) {
let mut log = self.query_log.lock().await; let mut log = self.query_log.lock().await;
if log.len() >= 1000 { if log.len() >= 1000 {

View File

@ -143,6 +143,7 @@ pub async fn run_server(
tracing::info!("Watching configuration file for hot-reload: {:?}", path_to_watch); tracing::info!("Watching configuration file for hot-reload: {:?}", path_to_watch);
let mut last_mtime = None; let mut last_mtime = None;
let mut _updated_outbound: Option<OutboundConfig> = None;
loop { loop {
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await; tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
if let Ok(metadata) = std::fs::metadata(&path_to_watch) { 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 { for bind_addr in &bind_addrs {
let addr = bind_addr.parse::<std::net::SocketAddr>().unwrap(); let addr = bind_addr.parse::<std::net::SocketAddr>().unwrap();
let tcp_map_clone = tcp_map.clone(); 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(); let udp_tx_clone = udp_tx.clone();
tokio::spawn(async move { tokio::spawn(async move {

View File

@ -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() { if cidrs.is_empty() {
return false; return false;
} }

View File

@ -82,10 +82,6 @@ fn parse_ostp_link(link: &str) -> Result<ClientConfig> {
let port = parsed.port().ok_or_else(|| anyhow!("Missing port in share link"))?; let port = parsed.port().ok_or_else(|| anyhow!("Missing port in share link"))?;
let server = format!("{host}:{port}"); let server = format!("{host}:{port}");
let mut sni = String::new(); 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 transport_mode = String::from("udp");
let mut tun_enabled = false; let mut tun_enabled = false;
let mut tun_dns = None; let mut tun_dns = None;
@ -94,10 +90,6 @@ fn parse_ostp_link(link: &str) -> Result<ClientConfig> {
for (k, v) in parsed.query_pairs() { for (k, v) in parsed.query_pairs() {
match &*k { match &*k {
"sni" => sni = v.into_owned(), "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(), "type" => transport_mode = v.into_owned(),
"tun" => tun_enabled = v == "true", "tun" => tun_enabled = v == "true",
"dns" => tun_dns = Some(v.into_owned()), "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<std::path::PathBuf> { fn wizard_save_config(config_path: &std::path::Path, json_value: &serde_json::Value) -> Result<std::path::PathBuf> {
let mut current_path = config_path.to_path_buf(); let current_path = config_path.to_path_buf();
// Attempt 1: write to requested path // Attempt 1: write to requested path
if let Some(parent) = current_path.parent() { 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 // Try import from link first
let use_link = wizard_yn("Do you have a share link (ostp://...)?", false); let use_link = wizard_yn("Do you have a share link (ostp://...)?", false);
let (server, access_key, sni, transport_mode) = if use_link { let (server, access_key, sni, transport_mode) = if use_link {
let mut p = url.query_pairs(); let link_str = wizard_prompt("Paste link", "");
let sni = p.find(|(k, _)| k == "sni").map(|(_, v): (&str, std::borrow::Cow<str>)| v.to_string()).unwrap_or_default(); let parsed = url::Url::parse(&link_str).unwrap();
let tm = p.find(|(k, _)| k == "type").map(|(_, v): (&str, std::borrow::Cow<str>)| v.to_string()).unwrap_or("udp".to_string()); let mut p = parsed.query_pairs();
(url.host_str().unwrap().to_string() + ":" + &url.port().unwrap_or(50000).to_string(), url.username().to_string(), sni, tm) 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 { } else {
("127.0.0.1:50000".to_string(), "".to_string(), "".to_string(), "udp".to_string()) ("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 // Build and save config
let key_for_gen = generate_secure_key("hex"); // unused but needed for init template let key_for_gen = generate_secure_key("hex");
let effective_sni = sni;
let _ = key_for_gen; let _ = key_for_gen;
let _ = &sni;
let client_json = serde_json::json!({ let client_json = serde_json::json!({
"mode": "client", "mode": "client",
@ -1367,7 +1361,7 @@ async fn run_app() -> Result<()> {
"sessions": 1 "sessions": 1
}}, }},
"debug": false "debug": false
}}"#, key, pub_key, sid) }}"#, key)
}; };
if let Some(parent) = args.config.parent() { if let Some(parent) = args.config.parent() {
if !parent.as_os_str().is_empty() { if !parent.as_os_str().is_empty() {
@ -1383,16 +1377,14 @@ async fn run_app() -> Result<()> {
if let AppMode::Server(s) = &config.mode { if let AppMode::Server(s) = &config.mode {
let key = &s.access_keys[0]; let key = &s.access_keys[0];
let host = get_or_ask_public_ip(&args.config); let host = get_or_ask_public_ip(&args.config);
let mut link = format!("ostp://{}@{}:50000", key.key(), host); let mut query_params = Vec::<String>::new();
let mut query_params = Vec::new();
query_params.push("type=udp".to_string()); query_params.push("type=udp".to_string());
}
let mut link = format!("ostp://{}@{}:50000", key.key(), host);
if !query_params.is_empty() { if !query_params.is_empty() {
link.push('?'); link.push('?');
link.push_str(&query_params.join("&")); link.push_str(&query_params.join("&"));
}
println!("\n Share link for client distribution:"); println!("\n Share link for client distribution:");
println!(" {}", link); println!(" {}", link);
} }
@ -1436,18 +1428,14 @@ async fn run_app() -> Result<()> {
println!("\n Client share links from {:?}:", args.config); println!("\n Client share links from {:?}:", args.config);
for (idx, key) in server_cfg.access_keys.iter().enumerate() { for (idx, key) in server_cfg.access_keys.iter().enumerate() {
let mut link = format!("ostp://{}@{}:{}", key.key(), host, port); let mut query_params = Vec::<String>::new();
let mut query_params = Vec::new();
query_params.push("type=udp".to_string()); query_params.push("type=udp".to_string());
}
let mut link = format!("ostp://{}@{}:{}", key.key(), host, port);
if !query_params.is_empty() { if !query_params.is_empty() {
link.push('?'); link.push('?');
link.push_str(&query_params.join("&")); link.push_str(&query_params.join("&"));
}
println!(" [{}] {}", idx + 1, link); println!(" [{}] {}", idx + 1, link);
} }
return Ok(()); return Ok(());