nx-gather-proxy 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/README.md +26 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/nx-gather-proxy.rb +2 -0
- data/lib/nx/gather-proxy.rb +30 -0
- data/lib/nx/version.rb +5 -0
- data/nx-gather-proxy-0.1.0.gem +0 -0
- data/nx-gather-proxy.gemspec +35 -0
- metadata +13 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54c09c0ceeb4463572996e18ddcbd5556349ec99769d15cc709d968ce214ea82
|
4
|
+
data.tar.gz: 8abeb403149db6fa0512a6aa1f3811f0f656d0b76246717f49c52c8c4a5b61ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30f76192636d181474b00f1eb172ea689fbddf013f2c57aca99116044949f1cd5cc17960bb66daef3f476ed827a1644fba9ba3668871233778365cb58f8af59c
|
7
|
+
data.tar.gz: 74344604bcf3f5ea608651d1d476a29b1f5032dc36ad1dac97fe516cb2d748fd29e3446a1465695592a407895ed06d331400d64367ecb5385a18d7a9050cbf0c
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# nx-gather-proxy
|
2
|
+
> Gather proxy for nx.
|
3
|
+
|
4
|
+
## installation
|
5
|
+
```rb
|
6
|
+
# from gem
|
7
|
+
gem 'nx-gather-proxy'
|
8
|
+
# from git
|
9
|
+
gem 'nx-gather-proxy', git: 'git@github.com:afeiship/nx-gather-proxy.git'
|
10
|
+
```
|
11
|
+
|
12
|
+
## usage
|
13
|
+
```rb
|
14
|
+
Nx::GatherProxy::fetch
|
15
|
+
|
16
|
+
# hello world
|
17
|
+
```
|
18
|
+
|
19
|
+
## build/publish
|
20
|
+
```shell
|
21
|
+
# build
|
22
|
+
gem build nx-gather-proxy.gemspec
|
23
|
+
|
24
|
+
# publish
|
25
|
+
gem push nx-gather-proxy-0.1.0.gem
|
26
|
+
```
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "nx-gather-proxy"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require "nokogiri"
|
2
|
+
require "open-uri"
|
3
|
+
|
4
|
+
module Nx
|
5
|
+
class GatherProxy
|
6
|
+
def self.fetch
|
7
|
+
re_port = /"PROXY_PORT":"(.*?)"/
|
8
|
+
re_ip = /"PROXY_IP":"(.*?)"/
|
9
|
+
|
10
|
+
doc = Nokogiri::HTML(
|
11
|
+
open(
|
12
|
+
"https://proxygather.com/proxylist/country?c=China",
|
13
|
+
read_timeout: 5,
|
14
|
+
)
|
15
|
+
)
|
16
|
+
|
17
|
+
# process html use selector
|
18
|
+
rows = doc.css("#tblproxy script")
|
19
|
+
data = []
|
20
|
+
rows.each do |row|
|
21
|
+
str = row.text
|
22
|
+
port = re_port.match(str)[1].to_i(16)
|
23
|
+
ip = re_ip.match(str)[1].to_s
|
24
|
+
data << { ip: ip, port: port }
|
25
|
+
end
|
26
|
+
|
27
|
+
return data
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/nx/version.rb
ADDED
Binary file
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "nx/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "nx-gather-proxy"
|
8
|
+
spec.version = Nx::GatherProxy::VERSION
|
9
|
+
spec.licenses = ["MIT"]
|
10
|
+
spec.authors = ["afeiship"]
|
11
|
+
spec.email = ["1290657123@qq.com"]
|
12
|
+
|
13
|
+
spec.summary = %q{Gather proxy.}
|
14
|
+
spec.description = %q{Gather proxy for nx.}
|
15
|
+
spec.homepage = "https://github.com/afeiship/nx-gather-proxy"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|__tests__|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
34
|
+
spec.add_development_dependency "rake", "~> 12.3", ">= 12.3.3"
|
35
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nx-gather-proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- afeiship
|
@@ -50,7 +50,18 @@ email:
|
|
50
50
|
executables: []
|
51
51
|
extensions: []
|
52
52
|
extra_rdoc_files: []
|
53
|
-
files:
|
53
|
+
files:
|
54
|
+
- ".gitignore"
|
55
|
+
- Gemfile
|
56
|
+
- README.md
|
57
|
+
- Rakefile
|
58
|
+
- bin/console
|
59
|
+
- bin/setup
|
60
|
+
- lib/nx-gather-proxy.rb
|
61
|
+
- lib/nx/gather-proxy.rb
|
62
|
+
- lib/nx/version.rb
|
63
|
+
- nx-gather-proxy-0.1.0.gem
|
64
|
+
- nx-gather-proxy.gemspec
|
54
65
|
homepage: https://github.com/afeiship/nx-gather-proxy
|
55
66
|
licenses:
|
56
67
|
- MIT
|