nx-gather-proxy 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30442fd1a4ee32349a8155ede35ade913905b8e9ea0ea47863e1ce5de3590468
4
- data.tar.gz: 6092bb37d7863808e9e303c27df4b753239861fffcda32312e899680bc45df62
3
+ metadata.gz: 54c09c0ceeb4463572996e18ddcbd5556349ec99769d15cc709d968ce214ea82
4
+ data.tar.gz: 8abeb403149db6fa0512a6aa1f3811f0f656d0b76246717f49c52c8c4a5b61ff
5
5
  SHA512:
6
- metadata.gz: 19d01356d6eb8d5015cb7d9101c56efba70093f6c376f680fc8d597c343fb603fc29698006c44c4c7bc84fbfdf2375abf156d7bae6a5c6063ffe6423e88d8700
7
- data.tar.gz: 2f498786a7be2cd8e746b22d3d45809fa897df6233f626e6d3352fc9da4806dbdb8509297939067ab842e03d7fc785a1e3c24643cdbf75b7b8b40ba28c07732f
6
+ metadata.gz: 30f76192636d181474b00f1eb172ea689fbddf013f2c57aca99116044949f1cd5cc17960bb66daef3f476ed827a1644fba9ba3668871233778365cb58f8af59c
7
+ data.tar.gz: 74344604bcf3f5ea608651d1d476a29b1f5032dc36ad1dac97fe516cb2d748fd29e3446a1465695592a407895ed06d331400d64367ecb5385a18d7a9050cbf0c
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in templates.gemspec
4
+ gemspec
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
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
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,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,2 @@
1
+ require "./nx/version"
2
+ require "./nx/gather-proxy"
@@ -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
@@ -0,0 +1,5 @@
1
+ module Nx
2
+ class GatherProxy
3
+ VERSION = "0.1.1"
4
+ end
5
+ end
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.0
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