Class: RaptorIO::Socket::Comm::SOCKS
- Inherits:
-
RaptorIO::Socket::Comm
- Object
- RaptorIO::Socket::Comm
- RaptorIO::Socket::Comm::SOCKS
- Defined in:
- lib/raptor-io/socket/comm/socks.rb
Overview
Communication through a SOCKS proxy
Defined Under Namespace
Modules: AddressTypes, ReplyCodes
Instance Attribute Summary collapse
-
#socks_comm ⇒ Comm
The RaptorIO::Socket::Comm used to connect to the SOCKS server.
-
#socks_host ⇒ String
The SOCKS server’s address.
-
#socks_port ⇒ Fixnum
The SOCKS server’s port.
Instance Method Summary collapse
-
#create_tcp(options) ⇒ Socket::TCP
Connect to ‘:peer_host`.
-
#initialize(options = {}) ⇒ SOCKS
constructor
A new instance of SOCKS.
- #support_ipv6? ⇒ Boolean
Methods inherited from RaptorIO::Socket::Comm
#create, #create_tcp_server, #create_udp, #create_udp_server, from_uri, #resolve, #reverse_resolve
Constructor Details
#initialize(options = {}) ⇒ SOCKS
Returns a new instance of SOCKS.
59 60 61 62 63 |
# File 'lib/raptor-io/socket/comm/socks.rb', line 59 def initialize( = {}) @socks_host = [:socks_host] @socks_port = [:socks_port].to_i @socks_comm = [:socks_comm] end |
Instance Attribute Details
#socks_comm ⇒ Comm
The RaptorIO::Socket::Comm used to connect to the SOCKS server
21 22 23 |
# File 'lib/raptor-io/socket/comm/socks.rb', line 21 def socks_comm @socks_comm end |
#socks_host ⇒ String
The SOCKS server’s address
13 14 15 |
# File 'lib/raptor-io/socket/comm/socks.rb', line 13 def socks_host @socks_host end |
#socks_port ⇒ Fixnum
The SOCKS server’s port
17 18 19 |
# File 'lib/raptor-io/socket/comm/socks.rb', line 17 def socks_port @socks_port end |
Instance Method Details
#create_tcp(options) ⇒ Socket::TCP
Connect to ‘:peer_host`
83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/raptor-io/socket/comm/socks.rb', line 83 def create_tcp() @socks_socket = socks_comm.create_tcp( peer_host: socks_host, peer_port: socks_port ) negotiate_connection([:peer_host], [:peer_port]) if [:ssl_context] RaptorIO::Socket::TCP::SSL.new(@socks_socket, ) else RaptorIO::Socket::TCP.new(@socks_socket, ) end end |