pub mod address; pub mod datagram; pub mod generic; pub mod listener; pub mod standard; pub mod stream; use crate::messages::ServerResponseStatus; pub use crate::network::address::SOCKSv5Address; pub use crate::network::standard::Builtin; use async_trait::async_trait; use futures::{AsyncRead, AsyncWrite}; use std::fmt; #[async_trait] pub trait Network { type Stream: AsyncRead + AsyncWrite + Clone + Send + Sync + Unpin + 'static; type Listener: SingleShotListener + Send + Sync + 'static; type UdpSocket; type Error: fmt::Debug + fmt::Display + Into; async fn connect>( &mut self, addr: A, port: u16, ) -> Result; async fn udp_socket>( &mut self, addr: A, port: Option, ) -> Result; async fn listen>( &mut self, addr: A, port: Option, ) -> Result; } #[async_trait] pub trait SingleShotListener { async fn accept(self) -> Result; fn info(&self) -> Result<(SOCKSv5Address, u16), Error>; }