Class: HTTPX::Plugins::Authentication::Socks5
- Inherits:
-
Object
- Object
- HTTPX::Plugins::Authentication::Socks5
- Defined in:
- lib/httpx/plugins/auth/socks5.rb
Instance Method Summary collapse
- #authenticate ⇒ Object
- #can_authenticate? ⇒ Boolean
-
#initialize(user, password) ⇒ Socks5
constructor
A new instance of Socks5.
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
#authenticate ⇒ Object
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
12 13 14 |
# File 'lib/httpx/plugins/auth/socks5.rb', line 12 def can_authenticate?(*) @user && @password end |