Ditch ToSocksAddress for the standard From/TryFrom.
This induces an added `Send` in the Network trait and its implementations, but provides us the ability to use standard functions with obvious extensions. So that's nice. I've also added some additional testing to sanity check the conversions.
This commit is contained in:
@@ -6,7 +6,7 @@ pub mod standard;
|
||||
pub mod stream;
|
||||
|
||||
use crate::messages::ServerResponseStatus;
|
||||
pub use crate::network::address::{SOCKSv5Address, ToSOCKSAddress};
|
||||
pub use crate::network::address::SOCKSv5Address;
|
||||
pub use crate::network::standard::Builtin;
|
||||
use async_trait::async_trait;
|
||||
use futures::{AsyncRead, AsyncWrite};
|
||||
@@ -19,17 +19,17 @@ pub trait Network {
|
||||
type UdpSocket;
|
||||
type Error: fmt::Debug + fmt::Display + Into<ServerResponseStatus>;
|
||||
|
||||
async fn connect<A: ToSOCKSAddress>(
|
||||
async fn connect<A: Into<SOCKSv5Address>>(
|
||||
&mut self,
|
||||
addr: A,
|
||||
port: u16,
|
||||
) -> Result<Self::Stream, Self::Error>;
|
||||
async fn udp_socket<A: ToSOCKSAddress>(
|
||||
async fn udp_socket<A: Into<SOCKSv5Address>>(
|
||||
&mut self,
|
||||
addr: A,
|
||||
port: Option<u16>,
|
||||
) -> Result<Self::UdpSocket, Self::Error>;
|
||||
async fn listen<A: ToSOCKSAddress>(
|
||||
async fn listen<A: Into<SOCKSv5Address>>(
|
||||
&mut self,
|
||||
addr: A,
|
||||
port: Option<u16>,
|
||||
|
||||
Reference in New Issue
Block a user