proxy_manager 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +95 -0
- data/lib/proxy_manager.rb +13 -0
- metadata +76 -19
- data/.rspec +0 -3
- data/README.rdoc +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b3f7a709cf3a85f0d3ab79c68823623ce793adf
|
4
|
+
data.tar.gz: cda96c254dec2a68e26121aabf8e09d47c8f794e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8827b0cd157a89c8fbe3fda76587c51ff151f74c439f649606d36ee5bf64604fa3b89eeff96cc1edb1d985d818902413dbf7b340ea1fbd648c7df6ec6c00fc8d
|
7
|
+
data.tar.gz: 42bbf016d03a8d91ac37fcbb74ea0d4dd6dd1a634aa8beec7170da4a4e60c596611cc9eb00328c2a1c812941cd6c9fe1e3d2e93ea9ad6ecbe64d0cb152ac8f64
|
data/README.md
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
# Ruby Proxy Manager
|
2
|
+
|
3
|
+
Easy manage proxy in your parsers/web-bots.
|
4
|
+
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'proxy_manager'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
```bash
|
17
|
+
$ bundle
|
18
|
+
```
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
```bash
|
23
|
+
$ gem install proxy_manager
|
24
|
+
```
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
### Load proxy list
|
29
|
+
|
30
|
+
From array (IP:PORT)
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
proxy = ProxyManager.load(['1.2.3.4:567', '9.8.7.6:543'])
|
34
|
+
```
|
35
|
+
|
36
|
+
or from file
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
proxy = ProxyManager.load('proxies.txt', 'bad_proxies.txt')
|
40
|
+
```
|
41
|
+
|
42
|
+
Files `proxies.txt` and `bad_proxies.txt` should be writable.
|
43
|
+
Example of `proxies.txt` content:
|
44
|
+
|
45
|
+
```
|
46
|
+
1.2.3.4:567
|
47
|
+
9.8.7.6:543
|
48
|
+
...
|
49
|
+
```
|
50
|
+
|
51
|
+
### Get proxy
|
52
|
+
|
53
|
+
Get one proxy
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
proxy.get
|
57
|
+
# => ["1.2.3.4", 567]
|
58
|
+
```
|
59
|
+
|
60
|
+
Get many proxies
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
proxy.get(2)
|
64
|
+
# => [["1.2.3.4", 567], ["9.8.7.6", 543]]
|
65
|
+
```
|
66
|
+
|
67
|
+
Will be returning only pingable proxies
|
68
|
+
|
69
|
+
### Proxies lists
|
70
|
+
|
71
|
+
You also can display list of loaded proxies
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
proxy.list
|
75
|
+
# => [["1.2.3.4", 567], ["9.8.7.6", 543]]
|
76
|
+
```
|
77
|
+
|
78
|
+
and list of bad proxies
|
79
|
+
|
80
|
+
```ruby
|
81
|
+
proxy.bad_list
|
82
|
+
# => []
|
83
|
+
```
|
84
|
+
|
85
|
+
## Documentation
|
86
|
+
|
87
|
+
http://rubydoc.info/gems/proxy_manager/frames
|
88
|
+
|
89
|
+
## Contributing
|
90
|
+
|
91
|
+
1. Fork it
|
92
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
93
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
94
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
95
|
+
5. Create new Pull Request
|
data/lib/proxy_manager.rb
CHANGED
@@ -2,10 +2,23 @@ require 'proxy_manager/main'
|
|
2
2
|
require 'net/ping'
|
3
3
|
|
4
4
|
module ProxyManager
|
5
|
+
# Define gem's root path
|
6
|
+
# @return [String] string path
|
5
7
|
def self.root
|
6
8
|
File.expand_path '../..', __FILE__
|
7
9
|
end
|
8
10
|
|
11
|
+
# Create main object
|
12
|
+
# @param proxies [Array, String] array of proxies or file with proxies
|
13
|
+
# @param bad_proxies [String, nil] optional file for save bad proxies
|
14
|
+
# @example
|
15
|
+
# # from array
|
16
|
+
# proxy = ProxyManager.load(['1.2.3.4:567', '9.8.7.6:543'])
|
17
|
+
#
|
18
|
+
# # or from file
|
19
|
+
# proxy = ProxyManager.load('proxies.txt', 'bad_proxies.txt')
|
20
|
+
# @return [Class] Main object
|
21
|
+
# @see Main
|
9
22
|
def self.load(proxies, bad_proxies = nil)
|
10
23
|
Main.new(proxies, bad_proxies)
|
11
24
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proxy_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirill Platonov
|
@@ -14,98 +14,153 @@ dependencies:
|
|
14
14
|
name: net-ping
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
17
20
|
- - ">="
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
22
|
+
version: 1.7.2
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.7'
|
24
30
|
- - ">="
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
32
|
+
version: 1.7.2
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: turn
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0.9'
|
31
40
|
- - ">="
|
32
41
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
42
|
+
version: 0.9.7
|
34
43
|
type: :development
|
35
44
|
prerelease: false
|
36
45
|
version_requirements: !ruby/object:Gem::Requirement
|
37
46
|
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0.9'
|
38
50
|
- - ">="
|
39
51
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
52
|
+
version: 0.9.7
|
41
53
|
- !ruby/object:Gem::Dependency
|
42
54
|
name: rspec
|
43
55
|
requirement: !ruby/object:Gem::Requirement
|
44
56
|
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '2.14'
|
45
60
|
- - ">="
|
46
61
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
62
|
+
version: 2.14.1
|
48
63
|
type: :development
|
49
64
|
prerelease: false
|
50
65
|
version_requirements: !ruby/object:Gem::Requirement
|
51
66
|
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '2.14'
|
52
70
|
- - ">="
|
53
71
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
72
|
+
version: 2.14.1
|
55
73
|
- !ruby/object:Gem::Dependency
|
56
74
|
name: guard-rspec
|
57
75
|
requirement: !ruby/object:Gem::Requirement
|
58
76
|
requirements:
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '4.2'
|
59
80
|
- - ">="
|
60
81
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
82
|
+
version: 4.2.8
|
62
83
|
type: :development
|
63
84
|
prerelease: false
|
64
85
|
version_requirements: !ruby/object:Gem::Requirement
|
65
86
|
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '4.2'
|
66
90
|
- - ">="
|
67
91
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
92
|
+
version: 4.2.8
|
69
93
|
- !ruby/object:Gem::Dependency
|
70
94
|
name: growl
|
71
95
|
requirement: !ruby/object:Gem::Requirement
|
72
96
|
requirements:
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '1.0'
|
73
100
|
- - ">="
|
74
101
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
102
|
+
version: 1.0.3
|
76
103
|
type: :development
|
77
104
|
prerelease: false
|
78
105
|
version_requirements: !ruby/object:Gem::Requirement
|
79
106
|
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '1.0'
|
80
110
|
- - ">="
|
81
111
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
112
|
+
version: 1.0.3
|
83
113
|
- !ruby/object:Gem::Dependency
|
84
114
|
name: fuubar
|
85
115
|
requirement: !ruby/object:Gem::Requirement
|
86
116
|
requirements:
|
117
|
+
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '1.3'
|
87
120
|
- - ">="
|
88
121
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
122
|
+
version: 1.3.2
|
90
123
|
type: :development
|
91
124
|
prerelease: false
|
92
125
|
version_requirements: !ruby/object:Gem::Requirement
|
93
126
|
requirements:
|
127
|
+
- - "~>"
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '1.3'
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 1.3.2
|
133
|
+
- !ruby/object:Gem::Dependency
|
134
|
+
name: yard
|
135
|
+
requirement: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0.8'
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 0.8.7.4
|
143
|
+
type: :development
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - "~>"
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0.8'
|
94
150
|
- - ">="
|
95
151
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
152
|
+
version: 0.8.7.4
|
97
153
|
description: |2
|
98
|
-
This gem is for easy usage proxy in your parsers/web-bots. It will manage
|
99
|
-
list and check availability.
|
154
|
+
This gem is for easy usage proxy in your parsers/web-bots. It will manage
|
155
|
+
your proxy list and check availability.
|
100
156
|
email:
|
101
157
|
- platonov.kd@gmail.com
|
102
158
|
executables: []
|
103
159
|
extensions: []
|
104
160
|
extra_rdoc_files: []
|
105
161
|
files:
|
106
|
-
- ".rspec"
|
107
162
|
- MIT-LICENSE
|
108
|
-
- README.
|
163
|
+
- README.md
|
109
164
|
- Rakefile
|
110
165
|
- lib/proxy_manager.rb
|
111
166
|
- lib/proxy_manager/main.rb
|
@@ -115,7 +170,8 @@ files:
|
|
115
170
|
- spec/support/bad_proxies.txt
|
116
171
|
- spec/support/proxies.txt
|
117
172
|
homepage: https://github.com/bloodyhistory/proxy_manager
|
118
|
-
licenses:
|
173
|
+
licenses:
|
174
|
+
- MIT
|
119
175
|
metadata: {}
|
120
176
|
post_install_message:
|
121
177
|
rdoc_options: []
|
@@ -136,9 +192,10 @@ rubyforge_project:
|
|
136
192
|
rubygems_version: 2.2.2
|
137
193
|
signing_key:
|
138
194
|
specification_version: 4
|
139
|
-
summary: Ruby proxy manager
|
195
|
+
summary: Ruby proxy manager for easy usage proxy in parser/web bots.
|
140
196
|
test_files:
|
141
197
|
- spec/proxy_manager/proxy_manager_spec.rb
|
142
198
|
- spec/spec_helper.rb
|
143
199
|
- spec/support/bad_proxies.txt
|
144
200
|
- spec/support/proxies.txt
|
201
|
+
has_rdoc:
|
data/.rspec
DELETED
data/README.rdoc
DELETED