class Excon::SOCKS5Socket
Public Class Methods
new(data = {})
click to toggle source
Calls superclass method
Excon::Socket::new
# File lib/excon/socks5_socket.rb, line 7 def initialize(data = {}) @socks5_proxy = data[:socks5_proxy] @proxy_host, @proxy_port, @proxy_user, @proxy_pass = parse_socks5_proxy(@socks5_proxy) super(data) end
Private Instance Methods
connect()
click to toggle source
Proxy-swap pattern: temporarily set @data to the SOCKS5 proxy so that Socket#connect routes the TCP connection there (inheriting DNS resolution, nonblock, retry, keepalive, reuseaddr, remote_ip tracking). After TCP is up, clear :proxy and run the SOCKS5 handshake.
Calls superclass method
Excon::Socket#connect
# File lib/excon/socks5_socket.rb, line 19 def connect @data[:proxy] = { host: @proxy_host, hostname: @proxy_host, port: @proxy_port.to_i } begin super ensure @data.delete(:proxy) end socks5_authenticate socks5_connect(@data[:host], @data[:port]) end