Module: EventMachine::Socksify
- Defined in:
- lib/em-socksify/errors.rb,
lib/em-socksify/socks5.rb,
lib/em-socksify/version.rb,
lib/em-socksify/socksify.rb
Defined Under Namespace
Modules: SOCKS5
Classes: SOCKSError
Constant Summary
collapse
- VERSION =
"0.2.0"
Instance Method Summary
collapse
Instance Method Details
#socks_hook ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/em-socksify/socksify.rb', line 17
def socks_hook
if @socks_version == 5
extend SOCKS5
else
raise ArgumentError, 'SOCKS version unsupported'
end
class << self
alias receive_data socks_receive_data
end
end
|
#socks_receive_data(data) ⇒ Object
37
38
39
40
|
# File 'lib/em-socksify/socksify.rb', line 37
def socks_receive_data(data)
@socks_data << data
socks_parse_response
end
|
#socks_unhook(ip = nil) ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/em-socksify/socksify.rb', line 29
def socks_unhook(ip = nil)
class << self
remove_method :receive_data
end
@socks_callback.call(ip)
end
|
#socksify(host, port, username = nil, password = nil, version = 5, &blk) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/em-socksify/socksify.rb', line 4
def socksify(host, port, username = nil, password = nil, version = 5, &blk)
@socks_target_host = host
@socks_target_port = port
@socks_username = username
@socks_password = password
@socks_version = version
@socks_callback = blk
@socks_data = ''
socks_hook
socks_send_handshake
end
|