mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-06 09:48:58 +00:00
2db655bd6d
* fix: refresh ACL groups and enable TCP_NODELAY for WebSocket * add remove_peers to remove list of peer id in ospf route * fix secure tunnel for unreliable udp tunnel * fix(web-client): timeout secure tunnel handshake * fix(web-server): tolerate delayed secure hello * fix quic endpoint panic * fix replay check
73 lines
1.9 KiB
Rust
73 lines
1.9 KiB
Rust
mod graph_algo;
|
|
|
|
pub mod acl_filter;
|
|
pub mod credential_manager;
|
|
pub mod peer;
|
|
pub mod peer_conn;
|
|
pub mod peer_conn_ping;
|
|
pub mod peer_manager;
|
|
pub mod peer_map;
|
|
pub mod peer_ospf_route;
|
|
pub mod peer_rpc;
|
|
pub mod peer_rpc_service;
|
|
pub mod peer_session;
|
|
pub mod relay_peer_map;
|
|
pub mod route_trait;
|
|
pub mod rpc_service;
|
|
mod traffic_metrics;
|
|
|
|
pub mod foreign_network_client;
|
|
pub mod foreign_network_manager;
|
|
|
|
pub mod encrypt;
|
|
pub(crate) mod secure_datagram;
|
|
|
|
pub mod peer_task;
|
|
|
|
#[cfg(test)]
|
|
pub mod tests;
|
|
|
|
use crate::tunnel::packet_def::ZCPacket;
|
|
|
|
#[async_trait::async_trait]
|
|
#[auto_impl::auto_impl(Arc)]
|
|
pub trait PeerPacketFilter {
|
|
async fn try_process_packet_from_peer(&self, _zc_packet: ZCPacket) -> Option<ZCPacket> {
|
|
Some(_zc_packet)
|
|
}
|
|
}
|
|
|
|
#[async_trait::async_trait]
|
|
#[auto_impl::auto_impl(Arc)]
|
|
pub trait NicPacketFilter {
|
|
async fn try_process_packet_from_nic(&self, data: &mut ZCPacket) -> bool;
|
|
|
|
fn id(&self) -> String {
|
|
format!("{:p}", self)
|
|
}
|
|
}
|
|
|
|
type BoxPeerPacketFilter = Box<dyn PeerPacketFilter + Send + Sync>;
|
|
type BoxNicPacketFilter = Box<dyn NicPacketFilter + Send + Sync>;
|
|
|
|
// pub type PacketRecvChan = tachyonix::Sender<ZCPacket>;
|
|
// pub type PacketRecvChanReceiver = tachyonix::Receiver<ZCPacket>;
|
|
// pub fn create_packet_recv_chan() -> (PacketRecvChan, PacketRecvChanReceiver) {
|
|
// tachyonix::channel(128)
|
|
// }
|
|
pub type PacketRecvChan = tokio::sync::mpsc::Sender<ZCPacket>;
|
|
pub type PacketRecvChanReceiver = tokio::sync::mpsc::Receiver<ZCPacket>;
|
|
pub fn create_packet_recv_chan() -> (PacketRecvChan, PacketRecvChanReceiver) {
|
|
tokio::sync::mpsc::channel(128)
|
|
}
|
|
pub async fn recv_packet_from_chan(
|
|
packet_recv_chan_receiver: &mut PacketRecvChanReceiver,
|
|
) -> Result<ZCPacket, anyhow::Error> {
|
|
packet_recv_chan_receiver
|
|
.recv()
|
|
.await
|
|
.ok_or(anyhow::anyhow!("recv_packet_from_chan failed"))
|
|
}
|
|
|
|
pub const PUBLIC_SERVER_HOSTNAME_PREFIX: &str = "PublicServer_";
|