module HTTPX::Plugins::Proxy::Socks5::Packet
def authenticate(parameters)
def authenticate(parameters) parameters.authenticate end
def connect(uri)
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
def negotiate(parameters)
def negotiate(parameters) methods = [NOAUTH] methods << PASSWD if parameters.can_authenticate? methods.unshift(methods.size) methods.unshift(VERSION) methods.pack("C*") end