changed mode
This commit is contained in:
parent
6e8f4583d6
commit
7fa2ffa04d
0
.cargo/config.toml
Normal file → Executable file
0
.cargo/config.toml
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
0
Cargo.lock
generated
Normal file → Executable file
0
Cargo.lock
generated
Normal file → Executable file
0
Cargo.toml
Normal file → Executable file
0
Cargo.toml
Normal file → Executable file
0
message.proto
Normal file → Executable file
0
message.proto
Normal file → Executable file
0
nat-simulator.sh
Normal file → Executable file
0
nat-simulator.sh
Normal file → Executable file
0
src/bin/build_pb/main.rs
Normal file → Executable file
0
src/bin/build_pb/main.rs
Normal file → Executable file
0
src/bin/sdlan/main.rs
Normal file → Executable file
0
src/bin/sdlan/main.rs
Normal file → Executable file
0
src/config/mod.rs
Normal file → Executable file
0
src/config/mod.rs
Normal file → Executable file
0
src/lib.rs
Normal file → Executable file
0
src/lib.rs
Normal file → Executable file
0
src/network/arp.rs
Normal file → Executable file
0
src/network/arp.rs
Normal file → Executable file
0
src/network/async_main.rs
Normal file → Executable file
0
src/network/async_main.rs
Normal file → Executable file
0
src/network/device.rs
Normal file → Executable file
0
src/network/device.rs
Normal file → Executable file
0
src/network/ipv6.rs
Normal file → Executable file
0
src/network/ipv6.rs
Normal file → Executable file
0
src/network/mod.rs
Normal file → Executable file
0
src/network/mod.rs
Normal file → Executable file
0
src/network/node.rs
Normal file → Executable file
0
src/network/node.rs
Normal file → Executable file
23
src/network/packet.rs
Normal file → Executable file
23
src/network/packet.rs
Normal file → Executable file
@ -14,7 +14,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use etherparse::Ethernet2Header;
|
use etherparse::Ethernet2Header;
|
||||||
use prost::Message;
|
use prost::Message;
|
||||||
use sdlan_sn_rs::utils::BROADCAST_MAC;
|
use sdlan_sn_rs::utils::{aes_encrypt, BROADCAST_MAC};
|
||||||
use sdlan_sn_rs::{
|
use sdlan_sn_rs::{
|
||||||
config::{AF_INET, AF_INET6},
|
config::{AF_INET, AF_INET6},
|
||||||
peer::{is_sdlan_sock_equal, SdlanSock, V6Info},
|
peer::{is_sdlan_sock_equal, SdlanSock, V6Info},
|
||||||
@ -581,7 +581,7 @@ pub async fn check_peer_registration_needed(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if now - last_seen > 300 {
|
if now - last_seen > 3 {
|
||||||
check_known_peer_sock_change(eee, from_sn, src_mac, peer_sock, now, false).await;
|
check_known_peer_sock_change(eee, from_sn, src_mac, peer_sock, now, false).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -809,6 +809,24 @@ async fn send_register(
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn printHex(key: &[u8]) {
|
||||||
|
let mut value = vec![];
|
||||||
|
for item in key {
|
||||||
|
value.push(format!("0x{:02x}", item))
|
||||||
|
}
|
||||||
|
println!("[{}]", value.join(" "))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_aes(key: &[u8]) {
|
||||||
|
let content = (1..=10).map(|f| f as u8).collect::<Vec<u8>>();
|
||||||
|
print!("test aes origin: ");
|
||||||
|
printHex(&content);
|
||||||
|
if let Ok(encrypted) = aes_encrypt(key, &content) {
|
||||||
|
print!("test aes: ");
|
||||||
|
printHex(&encrypted);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async fn handle_tun_packet(
|
async fn handle_tun_packet(
|
||||||
eee: &Node,
|
eee: &Node,
|
||||||
_from_sock: &SdlanSock,
|
_from_sock: &SdlanSock,
|
||||||
@ -823,6 +841,7 @@ async fn handle_tun_packet(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test_aes(key.as_slice());
|
||||||
let origin = aes_decrypt(key.as_slice(), &payload);
|
let origin = aes_decrypt(key.as_slice(), &payload);
|
||||||
if let Err(_e) = origin {
|
if let Err(_e) = origin {
|
||||||
error!("failed to decrypt original data");
|
error!("failed to decrypt original data");
|
||||||
|
|||||||
0
src/network/route.rs
Normal file → Executable file
0
src/network/route.rs
Normal file → Executable file
0
src/network/tun_linux.rs
Normal file → Executable file
0
src/network/tun_linux.rs
Normal file → Executable file
0
src/network/tun_win.rs
Normal file → Executable file
0
src/network/tun_win.rs
Normal file → Executable file
0
src/network/tuntap.c
Normal file → Executable file
0
src/network/tuntap.c
Normal file → Executable file
0
src/network/tuntap.rs
Normal file → Executable file
0
src/network/tuntap.rs
Normal file → Executable file
0
src/pb/message.rs
Normal file → Executable file
0
src/pb/message.rs
Normal file → Executable file
0
src/pb/mod.rs
Normal file → Executable file
0
src/pb/mod.rs
Normal file → Executable file
0
src/tcp/mod.rs
Normal file → Executable file
0
src/tcp/mod.rs
Normal file → Executable file
0
src/tcp/tcp_codec.rs
Normal file → Executable file
0
src/tcp/tcp_codec.rs
Normal file → Executable file
0
src/tcp/tcp_conn.rs
Normal file → Executable file
0
src/tcp/tcp_conn.rs
Normal file → Executable file
0
src/utils/command.rs
Normal file → Executable file
0
src/utils/command.rs
Normal file → Executable file
0
src/utils/mod.rs
Normal file → Executable file
0
src/utils/mod.rs
Normal file → Executable file
0
src/utils/pid_recorder.rs
Normal file → Executable file
0
src/utils/pid_recorder.rs
Normal file → Executable file
0
src/utils/socks.rs
Normal file → Executable file
0
src/utils/socks.rs
Normal file → Executable file
0
start_docker.sh
Normal file → Executable file
0
start_docker.sh
Normal file → Executable file
0
wintun.dll
Normal file → Executable file
0
wintun.dll
Normal file → Executable file
Loading…
x
Reference in New Issue
Block a user