mirror of
https://mirror.suhoan.cn/https://github.com/EasyTier/EasyTier.git
synced 2025-12-16 06:37:23 +08:00
zero copy tunnel (#55)
make tunnel zero copy, for better performance. remove most of the locks in io path. introduce quic tunnel prepare for encryption
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
pub mod packet;
|
||||
pub mod peer;
|
||||
pub mod peer_conn;
|
||||
// pub mod peer_conn;
|
||||
pub mod peer_conn_ping;
|
||||
pub mod peer_manager;
|
||||
pub mod peer_map;
|
||||
pub mod peer_ospf_route;
|
||||
@@ -8,6 +9,7 @@ pub mod peer_rip_route;
|
||||
pub mod peer_rpc;
|
||||
pub mod route_trait;
|
||||
pub mod rpc_service;
|
||||
pub mod zc_peer_conn;
|
||||
|
||||
pub mod foreign_network_client;
|
||||
pub mod foreign_network_manager;
|
||||
@@ -15,25 +17,24 @@ pub mod foreign_network_manager;
|
||||
#[cfg(test)]
|
||||
pub mod tests;
|
||||
|
||||
use tokio_util::bytes::{Bytes, BytesMut};
|
||||
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,
|
||||
_packet: &packet::ArchivedPacket,
|
||||
_data: &Bytes,
|
||||
) -> Option<()> {
|
||||
None
|
||||
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: BytesMut) -> BytesMut;
|
||||
async fn try_process_packet_from_nic(&self, data: &mut ZCPacket);
|
||||
}
|
||||
|
||||
type BoxPeerPacketFilter = Box<dyn PeerPacketFilter + Send + Sync>;
|
||||
type BoxNicPacketFilter = Box<dyn NicPacketFilter + Send + Sync>;
|
||||
|
||||
pub type PacketRecvChan = tokio::sync::mpsc::Sender<ZCPacket>;
|
||||
pub type PacketRecvChanReceiver = tokio::sync::mpsc::Receiver<ZCPacket>;
|
||||
|
||||
Reference in New Issue
Block a user