Class: TCPSocket

Inherits:
Object
  • Object
show all
Extended by:
Socksproxyable::ClassMethods
Includes:
Socksproxyable::InstanceMethodsAuthenticate, Socksproxyable::InstanceMethodsConnect
Defined in:
lib/socksify/tcpsocket.rb

Overview

monkey patch

Defined Under Namespace

Classes: SOCKSConnectionPeerAddress

Constant Summary

Constants included from Socksproxyable::ClassMethods

Socksproxyable::ClassMethods::SOCKS4_VERSIONS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Socksproxyable::ClassMethods

socks_ignores=, socks_version, socks_version_hex

Methods included from Socksproxyable::InstanceMethodsConnect

#socks_connect, #socks_receive_reply

Methods included from Socksproxyable::InstanceMethodsAuthenticate

#socks_authenticate

Constructor Details

#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

Instance Attribute Details

#socks_peerObject (readonly)

Returns the value of attribute socks_peer.



13
14
15
# File 'lib/socksify/tcpsocket.rb', line 13

def socks_peer
  @socks_peer
end

Instance Method Details

#initialize_tcpObject



11
# File 'lib/socksify/tcpsocket.rb', line 11

alias initialize_tcp initialize