torblocker 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/torblocker.rb +8 -4
- data/lib/torblocker/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27f6b795c965ace98b8efdf8d0105396745e38ca
|
4
|
+
data.tar.gz: 81b69b5e0c919cab91da1d706a47be205155d619
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cb4b7b7280aba4c01d2a3fc929477872a1f3802c45e09ebd4766aafed587506be8859c323550747427c8be2b76aac214a9d2354f0b9b7d9a91d799855108830
|
7
|
+
data.tar.gz: 94fb34a9fe15dbf767255324f2b58aad5b662270faed62560c97b7212fe735eb16b254689393349ea3694ae78a92276154912789797935c462f559c7f3587915
|
data/lib/torblocker.rb
CHANGED
@@ -2,19 +2,23 @@ require "torblocker/version"
|
|
2
2
|
|
3
3
|
module Torblocker
|
4
4
|
def self.untrusted?(ip,token)
|
5
|
-
uri = URI.parse('https://torblocker.com/v1?ip
|
5
|
+
uri = URI.parse('https://torblocker.com/v1?ip=' + ip.to_s)
|
6
6
|
http = Net::HTTP.new(uri.host, uri.port)
|
7
|
+
http.use_ssl = true
|
8
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
7
9
|
request = Net::HTTP::Get.new(uri)
|
8
|
-
request['authorization'] = "Token token
|
10
|
+
request['authorization'] = "Token token=" + token.to_s
|
9
11
|
response = http.request(request)
|
10
12
|
response.body == 1 || response.body == "1"
|
11
13
|
end
|
12
14
|
|
13
15
|
def self.trusted?(ip,token)
|
14
|
-
uri = URI.parse('
|
16
|
+
uri = URI.parse('http://torblocker.com/v1?ip=' + ip.to_s)
|
15
17
|
http = Net::HTTP.new(uri.host, uri.port)
|
18
|
+
http.use_ssl = true
|
19
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
16
20
|
request = Net::HTTP::Get.new(uri)
|
17
|
-
request['authorization'] = "Token token
|
21
|
+
request['authorization'] = "Token token=" + token.to_s
|
18
22
|
response = http.request(request)
|
19
23
|
response.body != 1 && response.body != "1"
|
20
24
|
end
|
data/lib/torblocker/version.rb
CHANGED