Class: HTTPX::Plugins::Authentication::Socks5

Inherits:
Object
  • Object
show all
Defined in:
lib/httpx/plugins/auth/socks5.rb

Instance Method Summary collapse

Constructor Details

#initialize(user, password) ⇒ Socks5

Returns a new instance of Socks5.



7
8
9
10
# File 'lib/httpx/plugins/auth/socks5.rb', line 7

def initialize(user, password, **)
  @user = user
  @password = password
end

Instance Method Details

#authenticateObject



16
17
18
# File 'lib/httpx/plugins/auth/socks5.rb', line 16

def authenticate(*)
  [0x01, @user.bytesize, @user, @password.bytesize, @password].pack("CCA*CA*")
end

#can_authenticate?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/httpx/plugins/auth/socks5.rb', line 12

def can_authenticate?(*)
  @user && @password
end