nx-real-ip 0.1.3 → 0.1.4

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: fe1595517abbe15c6aeddef2ba53675b53c4c5f6e70f3241f9868cd15c5110a1
4
- data.tar.gz: c1218d1b56c4387a8a5d1a54ce2671046ac2a98c6d4a6690e08176b5712045dc
3
+ metadata.gz: dcf5c22f2009789090e6e52d6046a871b7917e8e341f698d7a2ff43024839132
4
+ data.tar.gz: 3a61e74bdcf0bb9ce8ef71d13bd6e090d689730f03fbe3263a45770ef445445c
5
5
  SHA512:
6
- metadata.gz: 3454e9a46f80c635fa99b55f37b3381319189fccab476324be422f0034d8fd194254cc42c7a36ff312cf331d1960196812d55d13727cf5716f4dd634d945fa93
7
- data.tar.gz: 659b14c01f6da8253907e7bd63a58fa412faf0290bdda2362deb21232676eea645dfb124aa52cdf449574ee74dc5fd2b82b8234043cf1868ad7a251784b68d80
6
+ metadata.gz: a11fb0894a94e8f96f229793251cea81db1cd7366e9e7319e6211da8e5e543a3c560698535dbc874d9c6c03e1f43dcd27d2b8e6313b8fdd83020fe8fa02e0776
7
+ data.tar.gz: 9c7e497623d1becbeba9c2f83a4a8dbdd18a09646d1aeeefd0a009017ac360a229114912f617d9b00d30d42e1b630596558eb42519099eaed69fa2fc40718de3
data/lib/nx/real-ip.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require "open-uri"
2
2
 
3
+ RE_IP_ADDRESS = /\b\d+\.\d+\.\d+\.\d+\b/
4
+
3
5
  module Nx
4
6
  class RealIp
5
7
  def self.get(args = { timeout: 5, proxy: nil })
@@ -10,7 +12,11 @@ module Nx
10
12
  proxy: args[:proxy],
11
13
  ).read
12
14
 
13
- real_ip.strip
15
+ if RE_IP_ADDRESS.match? real_ip
16
+ real_ip.strip
17
+ else
18
+ nil
19
+ end
14
20
  end
15
21
  end
16
22
  end
data/lib/nx/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Nx
2
2
  class RealIp
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  end
5
5
  end
Binary file
data/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "nx-real-ip",
3
+ "version": "1.0.0",
4
+ "description": "> Get real ip address.",
5
+ "directories": {
6
+ "lib": "lib"
7
+ },
8
+ "scripts": {
9
+ "clean": "rm -rf *.gem",
10
+ "build": "gem build *.gemspec",
11
+ "pubpush": "gem push *.gem"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/afeiship/nx-real-ip.git"
16
+ },
17
+ "keywords": [],
18
+ "author": "",
19
+ "license": "ISC",
20
+ "bugs": {
21
+ "url": "https://github.com/afeiship/nx-real-ip/issues"
22
+ },
23
+ "homepage": "https://github.com/afeiship/nx-real-ip#readme"
24
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nx-real-ip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - afeiship
@@ -60,8 +60,9 @@ files:
60
60
  - lib/nx-real-ip.rb
61
61
  - lib/nx/real-ip.rb
62
62
  - lib/nx/version.rb
63
- - nx-real-ip-0.1.2.gem
63
+ - nx-real-ip-0.1.3.gem
64
64
  - nx-real-ip.gemspec
65
+ - package.json
65
66
  homepage: https://github.com/afeiship/nx-real-ip
66
67
  licenses:
67
68
  - MIT
data/nx-real-ip-0.1.2.gem DELETED
Binary file