fix some warning

This commit is contained in:
asxalex 2024-10-25 11:24:50 +08:00
parent c4c1f109b1
commit e7352c7b67

View File

@ -1,13 +1,19 @@
use std::{net::{IpAddr, Ipv6Addr}, time::Duration};
use std::sync::Mutex;
use std::{
net::{IpAddr, Ipv6Addr},
time::Duration,
};
use sdlan_sn_rs::{config::AF_INET6, peer::SdlanSock};
use std::sync::Arc;
use tokio::{net::UdpSocket, sync::mpsc::Receiver};
use tokio_util::sync::CancellationToken;
use tracing::error;
use std::sync::Arc;
use crate::{network::{loop_socket_v4, loop_socket_v6}, utils::Socket};
use crate::{
network::{loop_socket_v4, loop_socket_v6},
utils::Socket,
};
use super::Node;
@ -37,7 +43,6 @@ pub async fn run_ipv6(edge: &'static Node, mut v6_may_change: Receiver<bool>) {
let socket_clone = socket.clone();
let cancel = CancellationToken::new();
*edge.ipv6.write().unwrap() = Some(SdlanSock {
family: AF_INET6,
port,
@ -68,9 +73,9 @@ pub fn get_current_ipv6() -> Option<Ipv6Addr> {
continue;
}
IpAddr::V6(ipv6) => {
if (ipv6.octets()[0] & 0x70 == 0x20) {
if ipv6.octets()[0] & 0x70 == 0x20 {
println!("got global ip: {}", ipv6);
return Some(ipv6)
return Some(ipv6);
}
}
}