Module: HTTPX::Plugins::Proxy::Socks5::Packet
- Defined in:
- lib/httpx/plugins/proxy/socks5.rb
Class Method Summary collapse
Class Method Details
.authenticate(parameters) ⇒ Object
171 172 173 |
# File 'lib/httpx/plugins/proxy/socks5.rb', line 171 def authenticate(parameters) parameters.authenticate end |
.connect(uri) ⇒ Object
175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/httpx/plugins/proxy/socks5.rb', line 175 def connect(uri) packet = [VERSION, CONNECT, 0].pack("C*") begin ip = IPAddr.new(uri.host) ipcode = ip.ipv6? ? IPV6 : IPV4 packet << [ipcode].pack("C") << ip.hton rescue IPAddr::InvalidAddressError packet << [DOMAIN, uri.host.bytesize, uri.host].pack("CCA*") end packet << [uri.port].pack("n") packet end |