rack-detect-tor 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rack-detect-tor.rb +15 -22
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 689e8a3e35aa0b9b8eb807e9a295f0674e0f20f8
4
- data.tar.gz: 88f0f4160574255bac09f48a9e233f958b1693b1
3
+ metadata.gz: 9f10504d82ce574db5da49e72d82144b117fb1e3
4
+ data.tar.gz: 30321c1ddd369a663f97c292c708278b416ff9a0
5
5
  SHA512:
6
- metadata.gz: 1bfd6e3a4f0eca63f8f6e60f0ed125ed69c4094eafd3876f6b5ed9c3c071113e427c0ef7dd9008a03019b950f6205dfde40246709d203d59b297d9fd4a3c402a
7
- data.tar.gz: 37e278a94d8499600acc328b99c33db71befa4bebae143eb8669ea8d154d7108361defe3be6b35609a85a2987def6feb3e40046b1a4c35e7ba11b91a4afb39d0
6
+ metadata.gz: 1c8d9d5d3184ee346310385849557fb793dc844bf63c81c98d95e8c0d7b27b2531279118b04fafabb76a7167bb8782671c3d59b4984b65a284d9df82f05c69fd
7
+ data.tar.gz: 4708156c70c9c1dd287c6b2b05e209a0fbf9dcb6478be1b4b45b63b0e8e2548bd6a00304067500e275350bc893230e4c8a1f289b5c78620517b3a392aeead19a
@@ -33,29 +33,22 @@ module Rack
33
33
  private
34
34
 
35
35
  def fetch_tor_exits
36
- if @options.select{|k,v| k =~ /^external_/}.values.map{|v| v.to_s}.include? ''
37
- log_message "WARNING: external_ip/external_port not specified. Results will NOT be accurate"
38
-
39
- begin
40
- tor_exit_list = open('https://check.torproject.org/exit-addresses').read
41
- rescue OpenURI::HTTPError => e
42
- log_error "Error fetching list of tor exits: #{e}"
43
- end
44
-
45
- tor_exits = tor_exit_list.split("\n").select{|i| i =~ /^ExitAddress/}.
46
- map{|j| j.split(' ')[1]}
47
- else
48
- check_url = "https://check.torproject.org/cgi-bin/TorBulkExitList.py?" +
49
- "ip=#{@options['external_ip']}" +
50
- (@options['external_port'].nil? ? '' : "&port=#{@options['external_port']}")
51
-
52
- begin
53
- tor_exit_list = open(check_url).read
54
- rescue OpenURI::HTTPError => e
55
- log_error "Error fetching list of tor exits: #{e}"
36
+ begin
37
+ if @options.select{|k,v| k =~ /^external_/}.values.map{|v| v.to_s}.include? ''
38
+ log_message "WARNING: external_ip/external_port not specified. " +
39
+ "Using list of ALL exits. Results will NOT be accurate"
40
+
41
+ tor_exits = open('https://check.torproject.org/exit-addresses').read.
42
+ split("\n").select{|i| i =~ /^ExitAddress/}.map{|j| j.split(' ')[1]}
43
+ else
44
+ check_url = "https://check.torproject.org/cgi-bin/TorBulkExitList.py?" +
45
+ "ip=#{@options['external_ip']}&port=#{@options['external_port']}"
46
+
47
+ tor_exits = open(check_url).read.split("\n").select{|i| !(i =~ /^\#/)}
56
48
  end
57
-
58
- tor_exits = tor_exit_list.split("\n").select{|i| !(i =~ /^\#/)}
49
+ rescue OpenURI::HTTPError => e
50
+ log_error "Error fetching list of tor exits (#{e})."
51
+ return nil
59
52
  end
60
53
 
61
54
  log_message "Found #{tor_exits.count} exits."
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-detect-tor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Warren Guy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-20 00:00:00.000000000 Z
11
+ date: 2015-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack