warnings fix

This commit is contained in:
2026-03-20 15:36:56 +07:00
parent 1e5c8e899b
commit 4b3b1ef67b
20 changed files with 46 additions and 89 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
use crate::connections::ip_store::FakeIpStore;
use hickory_proto::op::{Message, MessageType, ResponseCode};
use hickory_proto::rr::{RData, Record, RecordType};
use netrunner_logger::{debug, error, info, warn};
use netrunner_logger::{error, info};
use std::collections::HashSet;
use std::time::{Duration, SystemTime};
use tokio::fs::{self, File};
+2 -2
View File
@@ -2,8 +2,8 @@ uniffi::setup_scaffolding!();
pub mod connections;
pub mod tun;
use netrunner_logger::info;
use std::{sync::OnceLock, time::Duration};
use tokio::{fs::File, io::AsyncWriteExt, runtime::Runtime};
use std::sync::OnceLock;
use tokio::runtime::Runtime;
use tokio_util::sync::CancellationToken;
use crate::tun::routing::reset_platform_routing;
+1 -1
View File
@@ -33,7 +33,7 @@ async fn main() -> anyhow::Result<()> {
.expect("Failed to initialize TUN device");
let remote_address: String = "62.60.244.156:443".into();
setup_platform_routing(&remote_address);
let _ = setup_platform_routing(&remote_address);
info!("TUN interface is UP: 10.0.0.1/24");
-1
View File
@@ -1,6 +1,5 @@
use super::{Session, SessionManager};
use std::sync::Arc;
use uniffi;
impl SessionManager {
pub fn start_desktop(&self, remote_address: String) -> Arc<Session> {
+4 -20
View File
@@ -1,14 +1,11 @@
use netrunner_core::protocol::codec::socks::TargetAddress;
use netrunner_logger::{debug, error, info, warn};
use netrunner_logger::{debug, info, warn};
use smoltcp::{
iface::{SocketHandle, SocketSet},
socket::{AnySocket, icmp, tcp, udp},
wire::{IpListenEndpoint, IpProtocol, Ipv4Packet, TcpPacket},
};
use std::{
collections::HashMap,
time::{Duration, Instant as StdInstant},
};
use std::{collections::HashMap, time::Instant as StdInstant};
use crate::connections::{
dns::DnsHandler, ip_store::FakeIpStore, tcp_connection::TcpConnection,
@@ -17,7 +14,7 @@ use crate::connections::{
pub struct ConnectionManager {
last_activity: HashMap<SocketHandle, StdInstant>,
active_tcp_sessions: HashMap<SocketHandle, TcpConnection>,
active_udp_sessions: HashMap<SocketHandle, UdpConnection>,
_active_udp_sessions: HashMap<SocketHandle, UdpConnection>,
dns_handler: DnsHandler,
fake_ip_store: FakeIpStore,
proxy_ip: String,
@@ -30,7 +27,7 @@ impl ConnectionManager {
Self {
last_activity: HashMap::new(),
active_tcp_sessions: HashMap::new(),
active_udp_sessions: HashMap::new(),
_active_udp_sessions: HashMap::new(),
proxy_ip: ip,
fake_ip_store: FakeIpStore::new(),
failed_until: HashMap::new(),
@@ -169,19 +166,6 @@ impl ConnectionManager {
}
}
fn create_tcp_socket<'a>() -> tcp::Socket<'a> {
const BUF_SIZE: usize = 512 * 1024;
let mut socket = tcp::Socket::new(
tcp::SocketBuffer::new(vec![0; BUF_SIZE]),
tcp::SocketBuffer::new(vec![0; BUF_SIZE]),
);
socket.set_nagle_enabled(false);
socket.set_ack_delay(None);
socket.set_keep_alive(Some(smoltcp::time::Duration::from_secs(30)));
socket.set_hop_limit(Some(64));
socket
}
fn create_dynamic_tcp_socket<'a>(port: u16) -> tcp::Socket<'a> {
let buf_size = match port {
443 | 80 => 2048 * 1024,
+3 -3
View File
@@ -1,4 +1,4 @@
use netrunner_logger::{error, info, warn};
use netrunner_logger::{error, info};
use std::io;
use std::process::Command;
@@ -150,7 +150,7 @@ pub fn setup_platform_routing(remote_address: &str) -> io::Result<()> {
Ok(())
}
pub fn reset_platform_routing(proxy_ip: Option<&str>) -> io::Result<()> {
pub fn reset_platform_routing(_proxy_ip: Option<&str>) -> io::Result<()> {
#[cfg(target_os = "linux")]
{
let _ = run_cmd_ext("ip link delete netr0", true);
@@ -165,7 +165,7 @@ pub fn reset_platform_routing(proxy_ip: Option<&str>) -> io::Result<()> {
let _ = run_cmd_ext("route delete 0.0.0.0 mask 128.0.0.0", true);
let _ = run_cmd_ext("route delete 128.0.0.0 mask 128.0.0.0", true);
if let Some(ip) = proxy_ip {
if let Some(ip) = _proxy_ip {
let _ = run_cmd_ext(&format!("route delete {}", ip), true);
}
+1 -1
View File
@@ -1,4 +1,4 @@
use netrunner_logger::{error, info, warn};
use netrunner_logger::error;
use std::io;
use tun::{AsyncDevice, Configuration, DeviceReader, DeviceWriter, create_as_async};