loggin update
This commit is contained in:
+1
-1
@@ -79,7 +79,7 @@ impl SessionManager {
|
||||
excluded_apps: Vec<String>,
|
||||
excluded_domains: Vec<String>,
|
||||
) -> Arc<Session> {
|
||||
netrunner_logger::Logger::init(None);
|
||||
netrunner_logger::Logger::init(None, false);
|
||||
netrunner_logger::Logger::global().set_level("info");
|
||||
|
||||
let runtime = get_runtime();
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ use tokio_util::sync::CancellationToken;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
netrunner_logger::Logger::init(None);
|
||||
netrunner_logger::Logger::init(None, false);
|
||||
netrunner_logger::Logger::global().set_level("error");
|
||||
info!("Initializing NetRunner Stack...");
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ use netrunner_core::{
|
||||
use smoltcp::{
|
||||
iface::SocketHandle,
|
||||
socket::{tcp, udp},
|
||||
time::Duration,
|
||||
wire::{
|
||||
Icmpv4Message, Icmpv4Packet, Icmpv6Message, Icmpv6Packet, IpAddress, IpEndpoint,
|
||||
Ipv6Address,
|
||||
@@ -15,7 +14,7 @@ use smoltcp::{
|
||||
use std::{collections::VecDeque, sync::atomic::Ordering};
|
||||
use tokio::sync::{mpsc, oneshot};
|
||||
|
||||
use netrunner_logger::{debug, info};
|
||||
use netrunner_logger::{debug, info, instrument};
|
||||
pub struct ConnectionCore<T> {
|
||||
pub handle: SocketHandle,
|
||||
pub tx: mpsc::Sender<T>,
|
||||
@@ -210,6 +209,10 @@ impl TcpConnection {
|
||||
self.pending_bytes
|
||||
}
|
||||
|
||||
#[instrument(skip(rx_smol, handshake_tx, tx_tunnel), fields(
|
||||
socket_id = socket_id,
|
||||
dst = %target
|
||||
))]
|
||||
pub fn spawn(
|
||||
socket_id: u64,
|
||||
dst_ip: std::net::Ipv4Addr,
|
||||
@@ -318,6 +321,10 @@ impl UdpConnection {
|
||||
true
|
||||
}
|
||||
|
||||
#[instrument(skip(rx_smol, tx_tunnel), fields(
|
||||
socket_id = socket_id,
|
||||
dst = %target
|
||||
))]
|
||||
pub fn spawn(
|
||||
socket_id: u64,
|
||||
dst_ip: std::net::Ipv4Addr,
|
||||
|
||||
@@ -378,7 +378,6 @@ impl EngineBuilder {
|
||||
let phys_gw = "192.168.1.1";
|
||||
|
||||
for domain in excluded_domains {
|
||||
// Резолвим домен средствами ОС (через системный DNS, не наш)
|
||||
if let Ok(addrs) = tokio::net::lookup_host(format!("{}:443", domain)).await {
|
||||
for addr in addrs {
|
||||
if let std::net::IpAddr::V4(ipv4) = addr.ip() {
|
||||
@@ -386,7 +385,6 @@ impl EngineBuilder {
|
||||
"Adding exception route for domain {} -> IP {}",
|
||||
domain, ipv4
|
||||
);
|
||||
// Прописываем маршрут в ОС мимо туннеля
|
||||
#[cfg(target_os = "linux")]
|
||||
let _ = crate::tun::routing::run_cmd_ext(
|
||||
&format!("ip route add {} via {}", ipv4, phys_gw),
|
||||
|
||||
@@ -2,7 +2,7 @@ use netrunner_logger::{error, info};
|
||||
use std::io;
|
||||
use std::process::Command;
|
||||
|
||||
fn run_cmd_ext(full_cmd: &str, ignore_errors: bool) -> io::Result<()> {
|
||||
pub fn run_cmd_ext(full_cmd: &str, ignore_errors: bool) -> io::Result<()> {
|
||||
let parts = shlex::split(full_cmd)
|
||||
.ok_or_else(|| io::Error::new(io::ErrorKind::InvalidInput, "Invalid syntax"))?;
|
||||
|
||||
@@ -55,7 +55,7 @@ fn get_default_gateway() -> Option<String> {
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn get_default_gateway_linux() -> Option<String> {
|
||||
pub fn get_default_gateway_linux() -> Option<String> {
|
||||
let output = Command::new("ip")
|
||||
.args(["route", "show", "default"])
|
||||
.output()
|
||||
|
||||
Reference in New Issue
Block a user