proxy_manager 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/proxy_manager/main.rb +15 -2
- data/proxy_manager.gemspec +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: 35ab032dab45fa2d252c021a447b8f46851b23ee
|
4
|
+
data.tar.gz: 25bde6a799ef93b589c66f68af8b139cc7feb716
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39f55eee88c8afbbc1e817e84a34c146473e02cad1b7ecb92a72bc476535bc1035ecd7dbbf6ed4785f4a7b2eec093c059b5846039dccde1e357eb0916dbf826f
|
7
|
+
data.tar.gz: 3818128cf8fb8040a5d362c67a153a9eee5c951ceaaf3be1b16c2227c52ef7cf8de6bd213414ed61635cae2c17661d4a180c7af3351d9e3ffa93ae24c9e82135
|
data/Gemfile.lock
CHANGED
data/lib/proxy_manager/main.rb
CHANGED
@@ -16,6 +16,7 @@ module ProxyManager
|
|
16
16
|
@list_file, @bad_list_file = proxies, bad_proxies
|
17
17
|
|
18
18
|
load_list_from_file(proxies)
|
19
|
+
load_bad_list_from_file(bad_proxies)
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
@@ -28,12 +29,13 @@ module ProxyManager
|
|
28
29
|
raise 'List is empty' if @list.empty?
|
29
30
|
|
30
31
|
items = []
|
32
|
+
new_list = @list.clone
|
31
33
|
|
32
34
|
@list.each_with_index do |proxy, key|
|
33
|
-
|
35
|
+
new_list.shift
|
34
36
|
|
35
37
|
if connectable? proxy
|
36
|
-
|
38
|
+
new_list << proxy
|
37
39
|
|
38
40
|
if count == 1
|
39
41
|
items = proxy
|
@@ -47,6 +49,8 @@ module ProxyManager
|
|
47
49
|
end
|
48
50
|
end
|
49
51
|
|
52
|
+
@list = new_list
|
53
|
+
|
50
54
|
raise 'There are no available proxy' if items.empty?
|
51
55
|
|
52
56
|
if @list_file && @bad_list_file
|
@@ -90,5 +94,14 @@ module ProxyManager
|
|
90
94
|
end
|
91
95
|
end
|
92
96
|
end
|
97
|
+
|
98
|
+
def load_bad_list_from_file(bad_proxies)
|
99
|
+
File.open(bad_proxies, "r").each do |line|
|
100
|
+
line = line.chomp.split(':')
|
101
|
+
if line[0].is_a? String and line[1].is_a? String
|
102
|
+
@bad_list << [line[0], line[1].to_i]
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
93
106
|
end
|
94
107
|
end
|
data/proxy_manager.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
# Describe your gem and declare its dependencies:
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "proxy_manager"
|
6
|
-
s.version = '0.0.
|
6
|
+
s.version = '0.0.9'
|
7
7
|
s.authors = ["Kirill Platonov"]
|
8
8
|
s.licenses = ['MIT']
|
9
9
|
s.email = ["platonov.kd@gmail.com"]
|