async fn read_request_reply(&mut self) -> Result<()> {
        let [version, reply, rsv, address_type] =
            read_exact!(self.socket, [0u8; 4]).context("Received malformed reply")?;

        debug!(
            "Reply received: [version: {version}, reply: {reply}, rsv: {rsv}, address_type: {address_type}]",
            version = version,
            reply = reply,
            rsv = rsv,
            address_type = address_type,
        );

        if version != consts::SOCKS5_VERSION {
            return Err(SocksError::UnsupportedSocksVersion(version));
        }

        if reply != consts::SOCKS5_REPLY_SUCCEEDED {
            return Err(ReplyError::from_u8(reply).into()); // Convert reply received into correct error
        }

        let address = read_address(&mut self.socket, address_type).await?;
        info!("Remote server connected to {}.", address);

        Ok(())
    }
/// The server send a confirmation (reply) that he had successfully connected (or not) to the
/// remote server.
The server send a confirmation (reply) that he had successfully connected (or not) to the
remote server.
The server send a confirmation ( reply ) that he had successfully connected ( or not ) to the remote server .
async fn read_request_reply(&mut self) -> Result<()> {
        let [version, reply, rsv, address_type] =
            read_exact!(self.socket, [0u8; 4]).context("Received malformed reply")?;
        debug!(
            "Reply received: [version: {version}, reply: {reply}, rsv: {rsv}, address_type: {address_type}]",
            version = version,
            reply = reply,
            rsv = rsv,
            address_type = address_type,
        );
        if version != consts::SOCKS5_VERSION {
            return Err(SocksError::UnsupportedSocksVersion(version));
        }
        if reply != consts::SOCKS5_REPLY_SUCCEEDED {
            return Err(ReplyError::from_u8(reply).into()); // Convert reply received into correct error
        }
        let address = read_address(&mut self.socket, address_type).await?;
        info!("Remote server connected to {}.", address);
        Ok(())
    }
async fn read_request_reply ( & mut self ) -> Result < ( ) > { let [ version , reply , rsv , address_type ] = read_exact ! ( self socket [ 0u8 4 ] ) . context ( " " ) ? ; debug ! ( " " version version reply reply rsv rsv address_type address_type ) ; if version != consts :: SOCKS5_VERSION { return Err ( SocksError :: UnsupportedSocksVersion ( version ) ) ; } if reply != consts :: SOCKS5_REPLY_SUCCEEDED { return Err ( ReplyError :: from_u8 ( reply ) . into ( ) ) ; // Convert reply received into correct error } let address = read_address ( & mut self . socket , address_type ) . await ? ; info ! ( " " address ) ; Ok ( ( ) ) }
The server send a confirmation (reply) that he had successfully connected (or not) to the
remote server.
The server send a confirmation ( reply ) that he had successfully connected ( or not ) to the remote server .
&mut self
&mut self