proxied 0.2.3 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e005242b58393ef158bf5c9174f37a1a9f8f0bfc28d7e2f6d2efe4dd8b055d9
4
- data.tar.gz: 3f8eb894ecedf42f9915d1c622430962fd08ae7f0f194b1bf3e813710deec428
3
+ metadata.gz: 66fa9a15a7dc064d83d93c7dd0c96cb8821b1c638de850da05c68ed3fcec1ac6
4
+ data.tar.gz: fac32c45c518a4bac720595d1f9878446eaa6b946422a7ffc424af62dd7203c2
5
5
  SHA512:
6
- metadata.gz: 8f72c919f4acae7c8dd32ea148f64e0e664de16dff6d2b2fb8050f5111ab32ff85f8ca266eb43459edc317d42abc1e83971aae839561ccc6ac5898870adc75b9
7
- data.tar.gz: cabff401d31f825a5b909a7a16f3ae9a9ce4e8ee26104c5e3dcc5cf9db1eb3a67e985b781005cbbbd4b4b00534a694447e7af616f650e3585a6e2128a86729bd
6
+ metadata.gz: fc6356e29975968288d793a93709e3fde7ff55bd5a79a7578e9c34cc814d8c7094c5c3b0db25bbf4721f7ce508fd28f0051c522d9b934a15dbb5dfd103087656
7
+ data.tar.gz: 6d04d66c21be01142c3f848600df54732fcfd85b974a4f10ff4994bb6b27f9204f8fc1a653a93792c36b76873691ff0f2b2879707d299129ff289e5b75e1c3f1
data/Gemfile CHANGED
@@ -5,4 +5,4 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
5
  # Specify your gem's dependencies in proxied.gemspec
6
6
  gemspec
7
7
 
8
- gem "rails", "~> 5.2"
8
+ gem 'rails', '~> 6.0', '>= 6.0.1'
@@ -1,61 +1,74 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- proxied (0.2.3)
4
+ proxied (0.2.5)
5
5
  faraday (>= 0.15.4)
6
6
  net-ssh (>= 5.2)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (5.2.3)
12
- actionpack (= 5.2.3)
11
+ actioncable (6.0.1)
12
+ actionpack (= 6.0.1)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
- actionmailer (5.2.3)
16
- actionpack (= 5.2.3)
17
- actionview (= 5.2.3)
18
- activejob (= 5.2.3)
15
+ actionmailbox (6.0.1)
16
+ actionpack (= 6.0.1)
17
+ activejob (= 6.0.1)
18
+ activerecord (= 6.0.1)
19
+ activestorage (= 6.0.1)
20
+ activesupport (= 6.0.1)
21
+ mail (>= 2.7.1)
22
+ actionmailer (6.0.1)
23
+ actionpack (= 6.0.1)
24
+ actionview (= 6.0.1)
25
+ activejob (= 6.0.1)
19
26
  mail (~> 2.5, >= 2.5.4)
20
27
  rails-dom-testing (~> 2.0)
21
- actionpack (5.2.3)
22
- actionview (= 5.2.3)
23
- activesupport (= 5.2.3)
28
+ actionpack (6.0.1)
29
+ actionview (= 6.0.1)
30
+ activesupport (= 6.0.1)
24
31
  rack (~> 2.0)
25
32
  rack-test (>= 0.6.3)
26
33
  rails-dom-testing (~> 2.0)
27
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
- actionview (5.2.3)
29
- activesupport (= 5.2.3)
34
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
35
+ actiontext (6.0.1)
36
+ actionpack (= 6.0.1)
37
+ activerecord (= 6.0.1)
38
+ activestorage (= 6.0.1)
39
+ activesupport (= 6.0.1)
40
+ nokogiri (>= 1.8.5)
41
+ actionview (6.0.1)
42
+ activesupport (= 6.0.1)
30
43
  builder (~> 3.1)
31
44
  erubi (~> 1.4)
32
45
  rails-dom-testing (~> 2.0)
33
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
34
- activejob (5.2.3)
35
- activesupport (= 5.2.3)
46
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
47
+ activejob (6.0.1)
48
+ activesupport (= 6.0.1)
36
49
  globalid (>= 0.3.6)
37
- activemodel (5.2.3)
38
- activesupport (= 5.2.3)
39
- activerecord (5.2.3)
40
- activemodel (= 5.2.3)
41
- activesupport (= 5.2.3)
42
- arel (>= 9.0)
43
- activestorage (5.2.3)
44
- actionpack (= 5.2.3)
45
- activerecord (= 5.2.3)
50
+ activemodel (6.0.1)
51
+ activesupport (= 6.0.1)
52
+ activerecord (6.0.1)
53
+ activemodel (= 6.0.1)
54
+ activesupport (= 6.0.1)
55
+ activestorage (6.0.1)
56
+ actionpack (= 6.0.1)
57
+ activejob (= 6.0.1)
58
+ activerecord (= 6.0.1)
46
59
  marcel (~> 0.3.1)
47
- activesupport (5.2.3)
60
+ activesupport (6.0.1)
48
61
  concurrent-ruby (~> 1.0, >= 1.0.2)
49
62
  i18n (>= 0.7, < 2)
50
63
  minitest (~> 5.1)
51
64
  tzinfo (~> 1.1)
65
+ zeitwerk (~> 2.2)
52
66
  addressable (2.7.0)
53
67
  public_suffix (>= 2.0.2, < 5.0)
54
68
  appraisal (2.2.0)
55
69
  bundler
56
70
  rake
57
71
  thor (>= 0.14.0)
58
- arel (9.0.0)
59
72
  axiom-types (0.1.1)
60
73
  descendants_tracker (~> 0.0.4)
61
74
  ice_nine (~> 0.11.0)
@@ -67,13 +80,13 @@ GEM
67
80
  concurrent-ruby (1.1.5)
68
81
  crack (0.4.3)
69
82
  safe_yaml (~> 1.0.0)
70
- crass (1.0.4)
83
+ crass (1.0.5)
71
84
  descendants_tracker (0.0.4)
72
85
  thread_safe (~> 0.3, >= 0.3.1)
73
86
  diff-lcs (1.3)
74
87
  equalizer (0.0.11)
75
- erubi (1.8.0)
76
- faraday (0.15.4)
88
+ erubi (1.9.0)
89
+ faraday (0.17.0)
77
90
  multipart-post (>= 1.2, < 3)
78
91
  generator_spec (0.9.4)
79
92
  activesupport (>= 3.0.0)
@@ -81,10 +94,10 @@ GEM
81
94
  globalid (0.4.2)
82
95
  activesupport (>= 4.2.0)
83
96
  hashdiff (1.0.0)
84
- i18n (1.6.0)
97
+ i18n (1.7.0)
85
98
  concurrent-ruby (~> 1.0)
86
99
  ice_nine (0.11.2)
87
- loofah (2.2.3)
100
+ loofah (2.3.1)
88
101
  crass (~> 1.0.2)
89
102
  nokogiri (>= 1.5.9)
90
103
  mail (2.7.1)
@@ -95,11 +108,11 @@ GEM
95
108
  mimemagic (0.3.3)
96
109
  mini_mime (1.0.2)
97
110
  mini_portile2 (2.4.0)
98
- minitest (5.12.0)
111
+ minitest (5.13.0)
99
112
  multipart-post (2.1.1)
100
113
  net-ssh (5.2.0)
101
114
  nio4r (2.5.2)
102
- nokogiri (1.10.4)
115
+ nokogiri (1.10.5)
103
116
  mini_portile2 (~> 2.4.0)
104
117
  pry (0.12.2)
105
118
  coderay (~> 1.1.0)
@@ -108,51 +121,53 @@ GEM
108
121
  rack (2.0.7)
109
122
  rack-test (1.1.0)
110
123
  rack (>= 1.0, < 3)
111
- rails (5.2.3)
112
- actioncable (= 5.2.3)
113
- actionmailer (= 5.2.3)
114
- actionpack (= 5.2.3)
115
- actionview (= 5.2.3)
116
- activejob (= 5.2.3)
117
- activemodel (= 5.2.3)
118
- activerecord (= 5.2.3)
119
- activestorage (= 5.2.3)
120
- activesupport (= 5.2.3)
124
+ rails (6.0.1)
125
+ actioncable (= 6.0.1)
126
+ actionmailbox (= 6.0.1)
127
+ actionmailer (= 6.0.1)
128
+ actionpack (= 6.0.1)
129
+ actiontext (= 6.0.1)
130
+ actionview (= 6.0.1)
131
+ activejob (= 6.0.1)
132
+ activemodel (= 6.0.1)
133
+ activerecord (= 6.0.1)
134
+ activestorage (= 6.0.1)
135
+ activesupport (= 6.0.1)
121
136
  bundler (>= 1.3.0)
122
- railties (= 5.2.3)
137
+ railties (= 6.0.1)
123
138
  sprockets-rails (>= 2.0.0)
124
139
  rails-dom-testing (2.0.3)
125
140
  activesupport (>= 4.2.0)
126
141
  nokogiri (>= 1.6)
127
- rails-html-sanitizer (1.2.0)
128
- loofah (~> 2.2, >= 2.2.2)
129
- railties (5.2.3)
130
- actionpack (= 5.2.3)
131
- activesupport (= 5.2.3)
142
+ rails-html-sanitizer (1.3.0)
143
+ loofah (~> 2.3)
144
+ railties (6.0.1)
145
+ actionpack (= 6.0.1)
146
+ activesupport (= 6.0.1)
132
147
  method_source
133
148
  rake (>= 0.8.7)
134
- thor (>= 0.19.0, < 2.0)
135
- rake (12.3.3)
149
+ thor (>= 0.20.3, < 2.0)
150
+ rake (13.0.1)
136
151
  rdoc (6.2.0)
137
- rspec-core (3.8.2)
138
- rspec-support (~> 3.8.0)
139
- rspec-expectations (3.8.4)
152
+ rspec-core (3.9.0)
153
+ rspec-support (~> 3.9.0)
154
+ rspec-expectations (3.9.0)
140
155
  diff-lcs (>= 1.2.0, < 2.0)
141
- rspec-support (~> 3.8.0)
142
- rspec-mocks (3.8.1)
156
+ rspec-support (~> 3.9.0)
157
+ rspec-mocks (3.9.0)
143
158
  diff-lcs (>= 1.2.0, < 2.0)
144
- rspec-support (~> 3.8.0)
145
- rspec-rails (3.8.2)
159
+ rspec-support (~> 3.9.0)
160
+ rspec-rails (3.9.0)
146
161
  actionpack (>= 3.0)
147
162
  activesupport (>= 3.0)
148
163
  railties (>= 3.0)
149
- rspec-core (~> 3.8.0)
150
- rspec-expectations (~> 3.8.0)
151
- rspec-mocks (~> 3.8.0)
152
- rspec-support (~> 3.8.0)
153
- rspec-support (3.8.2)
164
+ rspec-core (~> 3.9.0)
165
+ rspec-expectations (~> 3.9.0)
166
+ rspec-mocks (~> 3.9.0)
167
+ rspec-support (~> 3.9.0)
168
+ rspec-support (3.9.0)
154
169
  safe_yaml (1.0.5)
155
- sprockets (3.7.2)
170
+ sprockets (4.0.0)
156
171
  concurrent-ruby (~> 1.0)
157
172
  rack (> 1, < 3)
158
173
  sprockets-rails (3.2.1)
@@ -169,13 +184,14 @@ GEM
169
184
  coercible (~> 1.0)
170
185
  descendants_tracker (~> 0.0, >= 0.0.3)
171
186
  equalizer (~> 0.0, >= 0.0.9)
172
- webmock (3.7.5)
187
+ webmock (3.7.6)
173
188
  addressable (>= 2.3.6)
174
189
  crack (>= 0.3.2)
175
190
  hashdiff (>= 0.4.0, < 2.0.0)
176
191
  websocket-driver (0.7.1)
177
192
  websocket-extensions (>= 0.1.0)
178
193
  websocket-extensions (0.1.4)
194
+ zeitwerk (2.2.1)
179
195
 
180
196
  PLATFORMS
181
197
  ruby
@@ -186,7 +202,7 @@ DEPENDENCIES
186
202
  generator_spec (>= 0.9.4)
187
203
  proxied!
188
204
  pry (>= 0.12.2)
189
- rails (~> 5.2)
205
+ rails (~> 6.0, >= 6.0.1)
190
206
  rake (>= 12.3.2)
191
207
  rdoc (>= 6.1.1)
192
208
  rspec-core (>= 3.8)
@@ -11,8 +11,8 @@ module Proxied
11
11
  end
12
12
 
13
13
  module ClassMethods
14
- def should_be_checked(mode: :synchronous, protocol: :all, proxy_type: :all, category: nil, date: Time.now, limit: nil, maximum_failed_attempts: 10)
15
- proxies = get_proxies(protocol: protocol, proxy_type: proxy_type, category: category)
14
+ def should_be_checked(mode: :synchronous, protocol: :all, proxy_type: :all, category: nil, country: nil, date: Time.now, limit: nil, maximum_failed_attempts: 10)
15
+ proxies = get_proxies(protocol: protocol, proxy_type: proxy_type, category: category, country: country)
16
16
  proxies = proxies.where(checkable: true)
17
17
  proxies = proxies.where(asyncable: true) if mode.to_sym.eql?(:asynchronous)
18
18
 
@@ -34,8 +34,8 @@ module Proxied
34
34
  return proxies
35
35
  end
36
36
 
37
- def get_valid_proxies(protocol: :all, proxy_type: :all, category: nil, maximum_failed_attempts: nil)
38
- proxies = get_proxies(protocol: protocol, proxy_type: proxy_type, category: category)
37
+ def get_valid_proxies(protocol: :all, proxy_type: :all, category: nil, country: nil, maximum_failed_attempts: nil)
38
+ proxies = get_proxies(protocol: protocol, proxy_type: proxy_type, category: category, country: country)
39
39
  proxies = proxies.where(valid_proxy: true)
40
40
  proxies = proxies.where(:failed_attempts.lte => maximum_failed_attempts) if maximum_failed_attempts
41
41
  end
@@ -2,11 +2,12 @@ module Proxied
2
2
  module Shared
3
3
 
4
4
  module ClassMethods
5
- def get_proxies(protocol: :all, proxy_type: :all, category: nil)
5
+ def get_proxies(protocol: :all, proxy_type: :all, category: nil, country: nil)
6
6
  proxies = ::Proxy.where(nil)
7
- proxies = proxies.where(protocol: protocol) if (protocol && !protocol.downcase.to_sym.eql?(:all))
8
- proxies = proxies.where(proxy_type: proxy_type) if (proxy_type && !proxy_type.downcase.to_sym.eql?(:all))
9
- proxies = proxies.where(category: category) unless category.to_s.empty?
7
+ proxies = proxies.where(protocol: protocol) if (protocol && !protocol.downcase.to_sym.eql?(:all))
8
+ proxies = proxies.where(proxy_type: proxy_type) if (proxy_type && !proxy_type.downcase.to_sym.eql?(:all))
9
+ proxies = proxies.where(category: category) unless category.to_s.empty?
10
+ proxies = proxies.where(country: country.to_s.upcase) unless country.to_s.empty?
10
11
 
11
12
  return proxies
12
13
  end
@@ -23,7 +24,12 @@ module Proxied
23
24
 
24
25
  module InstanceMethods
25
26
  def proxy_address(include_http: false)
26
- ::Proxied::Utilities.format_proxy_address(host: self.host, port: self.port, include_http: include_http)
27
+ case self.auth_mode.to_sym
28
+ when :credentials
29
+ ::Proxied::Utilities.format_proxy_address(host: self.host, port: self.port, include_http: include_http)
30
+ when :basic_auth
31
+ ::Proxied::Utilities.format_proxy_address(host: self.host, port: self.port, username: self.username, password: self.password, include_http: include_http)
32
+ end
27
33
  end
28
34
 
29
35
  def proxy_credentials
@@ -38,9 +44,6 @@ module Proxied
38
44
  ::Proxied::Utilities.proxy_options_for_faraday(host: self.host, port: self.port, username: self.username, password: self.password, auth_mode: self.auth_mode)
39
45
  end
40
46
 
41
- def proxy_switcher_import_format
42
- ::Proxied::Utilities.proxy_switcher_import_format(host: self.host, port: self.port, username: self.username, password: self.password, country: self.country)
43
- end
44
47
  end
45
48
 
46
49
  end
@@ -11,8 +11,8 @@ module Proxied
11
11
  end
12
12
 
13
13
  module ClassMethods
14
- def should_be_checked(mode: :synchronous, protocol: :all, proxy_type: :all, category: nil, date: Time.now, limit: nil, maximum_failed_attempts: 10)
15
- proxies = get_proxies(protocol: protocol, proxy_type: proxy_type, category: category)
14
+ def should_be_checked(mode: :synchronous, protocol: :all, proxy_type: :all, category: nil, country: nil, date: Time.now, limit: nil, maximum_failed_attempts: 10)
15
+ proxies = get_proxies(protocol: protocol, proxy_type: proxy_type, category: category, country: country)
16
16
  proxies = proxies.where(checkable: true)
17
17
  proxies = proxies.where(asyncable: true) if mode.to_sym.eql?(:asynchronous)
18
18
  proxies = proxies.where(["(last_checked_at IS NULL OR last_checked_at < ?)", date])
@@ -23,16 +23,16 @@ module Proxied
23
23
  return proxies
24
24
  end
25
25
 
26
- def get_valid_proxies(protocol: :all, proxy_type: :all, category: nil, maximum_failed_attempts: nil)
27
- proxies = get_proxies(protocol: protocol, proxy_type: proxy_type, category: category)
26
+ def get_valid_proxies(protocol: :all, proxy_type: :all, category: nil, country: nil, maximum_failed_attempts: nil)
27
+ proxies = get_proxies(protocol: protocol, proxy_type: proxy_type, category: category, country: country)
28
28
  proxies = proxies.where(["valid_proxy = ? AND last_checked_at IS NOT NULL", true])
29
29
  proxies = proxies.where(["failed_attempts <= ?", maximum_failed_attempts]) if maximum_failed_attempts
30
30
 
31
31
  return proxies
32
32
  end
33
33
 
34
- def get_random_proxy(protocol: :all, proxy_type: :all, category: nil, maximum_failed_attempts: nil)
35
- proxies = get_valid_proxies(protocol: protocol, proxy_type: proxy_type, category: category, maximum_failed_attempts: maximum_failed_attempts)
34
+ def get_random_proxy(protocol: :all, proxy_type: :all, category: nil, country: nil, maximum_failed_attempts: nil)
35
+ proxies = get_valid_proxies(protocol: protocol, proxy_type: proxy_type, category: category, country: country, maximum_failed_attempts: maximum_failed_attempts)
36
36
  proxies = yield(proxies) if block_given?
37
37
 
38
38
  order_clause = case ActiveRecord::Base.connection.class.name
@@ -11,7 +11,11 @@ module Proxied
11
11
  end
12
12
 
13
13
  def format_proxy_credentials(username, password)
14
- return "#{username}:#{password}"
14
+ return "#{encode_credential(username)}:#{encode_credential(password)}"
15
+ end
16
+
17
+ def encode_credential(credential)
18
+ CGI::escape(credential)
15
19
  end
16
20
 
17
21
  def socks_proxy_credentials(username: nil, password: nil)
@@ -25,8 +29,8 @@ module Proxied
25
29
 
26
30
  def proxy_options_for_faraday(host:, port: 80, username: nil, password: nil, auth_mode: :credentials)
27
31
  proxy_options = {}
28
- username = CGI::escape(username)
29
- password = CGI::escape(password)
32
+ username = encode_credential(username)
33
+ password = encode_credential(password)
30
34
 
31
35
  options = {host: host, port: port, include_http: true}
32
36
  options[:username] = username if !username.to_s.empty? && auth_mode&.to_sym&.eql?(:basic_auth)
@@ -39,23 +43,6 @@ module Proxied
39
43
  return proxy_options
40
44
  end
41
45
 
42
- def proxy_switcher_import_format(host:, port: 80, username: nil, password: nil, country: nil)
43
- # Format:
44
- # COUNTRY_CODE,COUNTRY_NAME,CITY,USERNAME:PASSWORD@IP_ADDRESS:PORT
45
-
46
- address = ""
47
-
48
- if !country.to_s.empty?
49
- address += "#{country.upcase},,,"
50
- end
51
-
52
- if !username.to_s.empty? && !password.to_s.empty?
53
- address += "#{username}:#{password}@"
54
- end
55
-
56
- address += "#{host}:#{port}"
57
- end
58
-
59
46
  end
60
47
  end
61
48
  end
@@ -1,3 +1,3 @@
1
1
  module Proxied
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proxied
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-25 00:00:00.000000000 Z
11
+ date: 2019-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday