tor 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHORS +0 -1
- data/CREDITS +1 -0
- data/README.md +0 -5
- data/VERSION +1 -1
- data/lib/tor/config.rb +4 -3
- data/lib/tor/control.rb +9 -8
- data/lib/tor/dnsel.rb +18 -18
- data/lib/tor/version.rb +1 -1
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9f4d7cdee4cdba315a7851d2cad22501ee89d35fc9e16a8fbc8e817948a13e9
|
4
|
+
data.tar.gz: 1e45634091d9c257e26cf5e60eeb71f1c38fadb4da9ebfbf1879427d2d4e7622
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 402c526509d4e023171f22ad0b5078d834d06f45eb2e4ad500b5693d9af41300ddba663418e41f30db7bcc8ca2632800d1f4b11e78608358c1e96635b50d8ef4
|
7
|
+
data.tar.gz: d9c06427dd10c3e50c4c30486e2a0814bd0732e7be9b3e94d07d27dc4d467be5aff96652766e03270d5535103e6557b98318de0497fa612a10c4ee917668cf2b
|
data/AUTHORS
CHANGED
data/CREDITS
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
* Łukasz Wieczorek <wieczorek1990@gmail.com>
|
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.7
|
data/lib/tor/config.rb
CHANGED
@@ -47,9 +47,9 @@ module Tor
|
|
47
47
|
File.open(filename.to_s, 'rb') do |file|
|
48
48
|
file.each_line do |line|
|
49
49
|
case line = line.strip.chomp.strip
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
when '' then next # skip empty lines
|
51
|
+
when /^#/ then next # skip comments
|
52
|
+
else line = line.split('#').first.strip
|
53
53
|
end
|
54
54
|
# TODO: support for unquoting and unescaping values
|
55
55
|
config << line.split(/\s+/, 2)
|
@@ -97,6 +97,7 @@ module Tor
|
|
97
97
|
# @return [Enumerator]
|
98
98
|
def each(key = nil, &block)
|
99
99
|
return enum_for(:each, key) unless block_given?
|
100
|
+
|
100
101
|
key ? @lines.find_all { |k, v| key === k }.each(&block) : @lines.each(&block)
|
101
102
|
end
|
102
103
|
end
|
data/lib/tor/control.rb
CHANGED
@@ -152,11 +152,11 @@ module Tor
|
|
152
152
|
loop do
|
153
153
|
# TODO: support for reading multiple authentication methods
|
154
154
|
case reply = read_reply
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
155
|
+
when /^250-AUTH METHODS=(\w*)/
|
156
|
+
method = $1.strip.downcase.to_sym
|
157
|
+
method = method.eql?(:null) ? nil : method
|
158
|
+
when /^250-/ then next
|
159
|
+
when '250 OK' then break
|
160
160
|
end
|
161
161
|
end
|
162
162
|
method
|
@@ -192,8 +192,8 @@ module Tor
|
|
192
192
|
cookie ||= @options[:cookie]
|
193
193
|
send(:send_line, cookie ? "AUTHENTICATE #{cookie}" : "AUTHENTICATE")
|
194
194
|
case reply = read_reply
|
195
|
-
|
196
|
-
|
195
|
+
when '250 OK' then @authenticated = true
|
196
|
+
else raise AuthenticationError.new(reply)
|
197
197
|
end
|
198
198
|
self
|
199
199
|
end
|
@@ -252,6 +252,7 @@ module Tor
|
|
252
252
|
read_reply # skip "250+config-text="
|
253
253
|
while line = read_reply
|
254
254
|
break unless line != "."
|
255
|
+
|
255
256
|
reply.concat(line + "\n")
|
256
257
|
end
|
257
258
|
read_reply # skip "250 OK"
|
@@ -270,7 +271,7 @@ module Tor
|
|
270
271
|
read_reply
|
271
272
|
end
|
272
273
|
|
273
|
-
|
274
|
+
protected
|
274
275
|
|
275
276
|
##
|
276
277
|
# Sends a command line over the socket.
|
data/lib/tor/dnsel.rb
CHANGED
@@ -21,7 +21,7 @@ module Tor
|
|
21
21
|
def self.include?(host)
|
22
22
|
begin
|
23
23
|
query(host) == '127.0.0.2'
|
24
|
-
rescue Resolv::ResolvError
|
24
|
+
rescue Resolv::ResolvError # NXDOMAIN
|
25
25
|
false
|
26
26
|
rescue Resolv::ResolvTimeout
|
27
27
|
nil
|
@@ -61,7 +61,7 @@ module Tor
|
|
61
61
|
end
|
62
62
|
class << self; alias_method :hostname, :dnsname; end
|
63
63
|
|
64
|
-
|
64
|
+
protected
|
65
65
|
|
66
66
|
##
|
67
67
|
# Resolves `host` into an IPv4 address using Ruby's default resolver.
|
@@ -78,22 +78,22 @@ module Tor
|
|
78
78
|
# @return [String]
|
79
79
|
def self.getaddress(host, reversed = false)
|
80
80
|
host = case host.to_s
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
81
|
+
when Resolv::IPv6::Regex
|
82
|
+
raise ArgumentError.new("not an IPv4 address: #{host}")
|
83
|
+
when Resolv::IPv4::Regex
|
84
|
+
host.to_s
|
85
|
+
else
|
86
|
+
begin
|
87
|
+
RESOLVER.each_address(host.to_s) do |addr|
|
88
|
+
return addr.to_s if addr.to_s =~ Resolv::IPv4::Regex
|
89
|
+
end
|
90
|
+
raise Resolv::ResolvError.new("no address for #{host}")
|
91
|
+
rescue NoMethodError
|
92
|
+
# This is a workaround for Ruby bug #2614:
|
93
|
+
# @see http://redmine.ruby-lang.org/issues/show/2614
|
94
|
+
raise Resolv::ResolvError.new("no address for #{host}")
|
95
|
+
end
|
96
|
+
end
|
97
97
|
reversed ? host.split('.').reverse.join('.') : host
|
98
98
|
end
|
99
99
|
end
|
data/lib/tor/version.rb
CHANGED
metadata
CHANGED
@@ -1,35 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arto Bendiken
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0.6'
|
20
17
|
- - ">="
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: 0.6.0
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0.6'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0.6'
|
30
27
|
- - ">="
|
31
28
|
- !ruby/object:Gem::Version
|
32
29
|
version: 0.6.0
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0.6'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rspec
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,7 +64,7 @@ homepage: https://rubygems.org/gems/tor/
|
|
64
64
|
licenses:
|
65
65
|
- Unlicense
|
66
66
|
metadata: {}
|
67
|
-
post_install_message:
|
67
|
+
post_install_message:
|
68
68
|
rdoc_options: []
|
69
69
|
require_paths:
|
70
70
|
- lib
|
@@ -80,8 +80,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
requirements:
|
82
82
|
- Tor (>= 0.2.1.25)
|
83
|
-
rubygems_version: 3.
|
84
|
-
signing_key:
|
83
|
+
rubygems_version: 3.0.3.1
|
84
|
+
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: Onion routing for Ruby.
|
87
87
|
test_files: []
|