Associate

Struct Associate 

Source
pub struct Associate<S> { /* private fields */ }
Expand description

Socks5 command type Associate

Reply the client with Associate::reply() to complete the command negotiation.

Implementations§

Source§

impl Associate<NeedReply>

Source

pub async fn reply( self, reply: Reply, addr: Address, ) -> Result<Associate<Ready>, (Error, TcpStream)>

Reply to the SOCKS5 client with the given reply and address.

If encountered an error while writing the reply, the error alongside the original TcpStream is returned.

Source§

impl Associate<Ready>

Source

pub async fn wait_close(&mut self) -> Result<(), Error>

Wait until the SOCKS5 client closes this TCP connection.

Socks5 protocol defines that when the client closes the TCP connection used to send the associate command, the server should release the associated UDP socket.

Source§

impl<S> Associate<S>

Source

pub async fn close(&mut self) -> Result<(), Error>

Causes the other peer to receive a read of length 0, indicating that no more data will be sent. This only closes the stream in one direction.

Source

pub fn local_addr(&self) -> Result<SocketAddr, Error>

Returns the local address that this stream is bound to.

Source

pub fn peer_addr(&self) -> Result<SocketAddr, Error>

Returns the remote address that this stream is connected to.

Source

pub fn get_ref(&self) -> &TcpStream

Returns a shared reference to the underlying stream.

Note that this may break the encapsulation of the SOCKS5 connection and you should not use this method unless you know what you are doing.

Source

pub fn get_mut(&mut self) -> &mut TcpStream

Returns a mutable reference to the underlying stream.

Note that this may break the encapsulation of the SOCKS5 connection and you should not use this method unless you know what you are doing.

Source

pub fn into_inner(self) -> TcpStream

Consumes the Associate<S> and returns the underlying TcpStream.

Trait Implementations§

Source§

impl<S: Debug> Debug for Associate<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S> !Freeze for Associate<S>

§

impl<S> RefUnwindSafe for Associate<S>
where S: RefUnwindSafe,

§

impl<S> Send for Associate<S>
where S: Send,

§

impl<S> Sync for Associate<S>
where S: Sync,

§

impl<S> Unpin for Associate<S>
where S: Unpin,

§

impl<S> UnwindSafe for Associate<S>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.