Method: TCPSocket#initialize

Defined in:
lib/socksify/tcpsocket.rb

#initialize(host = nil, port = nil, local_host = nil, local_port = nil, **kwargs) ⇒ TCPSocket

See tools.ietf.org/html/rfc1928 rubocop:disable Metrics/ParameterLists



17
18
19
20
21
22
23
24
25
26
# File 'lib/socksify/tcpsocket.rb', line 17

def initialize(host = nil, port = nil, local_host = nil, local_port = nil, **kwargs)
  @socks_peer = host if host.is_a?(SOCKSConnectionPeerAddress)
  host = socks_peer.peer_host if socks_peer

  if socks_server && socks_port && !socks_ignores.include?(host)
    make_socks_connection(host, port, **kwargs)
  else
    make_direct_connection(host, port, local_host, local_port, **kwargs)
  end
end