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

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

Instance Method Summary collapse

Constructor Details

#initialize(user, password) ⇒ Socks5

Returns a new instance of Socks5.

Parameters:

  • user (string)
  • password (string)


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

#authenticateString

Parameters:

  • (Object)

Returns:

  • (String)


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

Parameters:

  • (Object)

Returns:

  • (Boolean)


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

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