async fn can_accept_method(&mut self, client_methods: Vec<u8>) -> Result<()> {
        let method_supported;

        if self.config.auth.is_some() {
            method_supported = consts::SOCKS5_AUTH_METHOD_PASSWORD;
        } else {
            method_supported = consts::SOCKS5_AUTH_METHOD_NONE;
        }

        if !client_methods.contains(&method_supported) {
            debug!("Don't support this auth method, reply with (0xff)");
            self.inner
                .write(&[
                    consts::SOCKS5_VERSION,
                    consts::SOCKS5_AUTH_METHOD_NOT_ACCEPTABLE,
                ])
                .await
                .context("Can't reply with method not acceptable.")?;

            return Err(SocksError::AuthMethodUnacceptable(client_methods));
        }

        debug!(
            "Reply with method {} ({})",
            AuthenticationMethod::from_u8(method_supported).context("Method not supported")?,
            method_supported
        );
        self.inner
            .write(&[consts::SOCKS5_VERSION, method_supported])
            .await
            .context("Can't reply with method auth-none")?;
        Ok(())
    }
/// Decide to whether or not, accept the authentication method.
/// Don't forget that the methods list sent by the client, contains one or more methods.
///
/// # Request
///
///  Client send an array of 3 entries: [0, 1, 2]
///
///                          {SOCKS Version,  Authentication chosen}
///     eg. (non-auth)       {5, 0}
///     eg. (GSSAPI)         {5, 1}
///     eg. (auth)           {5, 2}
///
/// # Response
///     
///     eg. (accept non-auth) {5, 0x00}
///     eg. (non-acceptable)  {5, 0xff}
///
Decide to whether or not, accept the authentication method.
Don't forget that the methods list sent by the client, contains one or more methods.
Decide to whether or not accept the authentication method . Don ' t forget that the methods list sent by the client contains one or more methods .
async fn can_accept_method(&mut self, client_methods: Vec<u8>) -> Result<()> {
        let method_supported;
        if self.config.auth.is_some() {
            method_supported = consts::SOCKS5_AUTH_METHOD_PASSWORD;
        } else {
            method_supported = consts::SOCKS5_AUTH_METHOD_NONE;
        }
        if !client_methods.contains(&method_supported) {
            debug!("Don't support this auth method, reply with (0xff)");
            self.inner
                .write(&[
                    consts::SOCKS5_VERSION,
                    consts::SOCKS5_AUTH_METHOD_NOT_ACCEPTABLE,
                ])
                .await
                .context("Can't reply with method not acceptable.")?;
            return Err(SocksError::AuthMethodUnacceptable(client_methods));
        }
        debug!(
            "Reply with method {} ({})",
            AuthenticationMethod::from_u8(method_supported).context("Method not supported")?,
            method_supported
        );
        self.inner
            .write(&[consts::SOCKS5_VERSION, method_supported])
            .await
            .context("Can't reply with method auth-none")?;
        Ok(())
    }
async fn can_accept_method ( & mut self , client_methods : Vec < u8 > ) -> Result < ( ) > { let method_supported ; if self . config . auth . is_some ( ) { method_supported = consts :: SOCKS5_AUTH_METHOD_PASSWORD ; } else { method_supported = consts :: SOCKS5_AUTH_METHOD_NONE ; } if ! client_methods . contains ( & method_supported ) { debug ! ( " " ) ; self . inner . write ( & [ consts :: SOCKS5_VERSION , consts :: SOCKS5_AUTH_METHOD_NOT_ACCEPTABLE , ] ) . await . context ( " " ) ? ; return Err ( SocksError :: AuthMethodUnacceptable ( client_methods ) ) ; } debug ! ( " " AuthenticationMethod from_u8 ( method_supported ) context ( " " ) method_supported ) ; self . inner . write ( & [ consts :: SOCKS5_VERSION , method_supported ] ) . await . context ( " " ) ? ; Ok ( ( ) ) }
Decide to whether or not, accept the authentication method.
Decide to whether or not accept the authentication method .
&mut self
client_methods
Vec<u8>
&mut self
client_methods
Vec<u8>
request
Client send an array of 3 entries: [0, 1, 2]

{SOCKS Version,  Authentication chosen}
eg.
Client send an array of 3 entries : [ 0 1 2 ] { SOCKS Version Authentication chosen } eg .
response
None