em-socksify 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,7 +18,7 @@ module EventMachine
18
18
  send_data [5, 1, 0].pack('CCC')
19
19
 
20
20
  if matches = @socks_target_host.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/)
21
- send_data "\xF1\x00\x01" + matches.to_a[1 .. -1].map { |s| s.to_i }.pack('CCCC')
21
+ send_data "\x01" + matches.to_a[1 .. -1].map { |s| s.to_i }.pack('CCCC')
22
22
 
23
23
  elsif @socks_target_host =~ /^[:0-9a-f]+$/
24
24
  raise SOCKSError, 'TCP/IPv6 over SOCKS is not yet supported (inet_pton missing in Ruby & not supported by Tor)'
@@ -100,6 +100,8 @@ module EventMachine
100
100
 
101
101
  socks_unhook(ip)
102
102
  end
103
+ rescue Exception => e
104
+ @socks_deferrable.fail(e)
103
105
  end
104
106
 
105
107
  def socks_methods
@@ -7,11 +7,14 @@ module EventMachine
7
7
  @socks_username = username
8
8
  @socks_password = password
9
9
  @socks_version = version
10
- @socks_callback = blk
11
10
  @socks_data = ''
12
11
 
13
12
  socks_hook
14
13
  socks_send_handshake
14
+
15
+ @socks_deferrable = DefaultDeferrable.new
16
+ @socks_deferrable.callback(&blk) if blk
17
+ @socks_deferrable
15
18
  end
16
19
 
17
20
  def socks_hook
@@ -31,7 +34,7 @@ module EventMachine
31
34
  remove_method :receive_data
32
35
  end
33
36
 
34
- @socks_callback.call(ip)
37
+ @socks_deferrable.succeed(ip)
35
38
  end
36
39
 
37
40
  def socks_receive_data(data)
@@ -1,7 +1,7 @@
1
1
  module EventMachine
2
2
 
3
3
  module Socksify
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
6
6
 
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-socksify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-28 00:00:00.000000000 Z
12
+ date: 2012-08-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
16
- requirement: &2156395280 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 1.0.0.beta.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2156395280
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.0.0.beta.4
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rspec
27
- requirement: &2156394860 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,7 +37,12 @@ dependencies:
32
37
  version: '0'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *2156394860
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  description: ! 'EventMachine SOCKSify shim: adds SOCKS support to any protocol'
37
47
  email:
38
48
  - ilya@igvita.com
@@ -73,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
83
  version: '0'
74
84
  requirements: []
75
85
  rubyforge_project: em-socksify
76
- rubygems_version: 1.8.10
86
+ rubygems_version: 1.8.24
77
87
  signing_key:
78
88
  specification_version: 3
79
89
  summary: ! 'EventMachine SOCKSify shim: adds SOCKS support to any protocol'