nx-real-ip 0.1.1 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nx-real-ip.rb +2 -2
- data/lib/nx/real-ip.rb +18 -8
- data/lib/nx/version.rb +1 -1
- data/nx-real-ip-0.1.4.gem +0 -0
- data/nx-real-ip-0.1.5.gem +0 -0
- data/package.json +24 -0
- metadata +6 -4
- data/nx-real-ip-0.1.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: feab46862cb76e215b2534a235e376e723f403f189d5af79db59e477f8080028
|
4
|
+
data.tar.gz: 8bf598306a884cb84ac4466e29489b3c22efde20979f4cf1782f20816daf8a37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3c3e869b122a051480ca76f1f6ebdf7a6a7aa8fad5828752803682bd94c827791b71675aca4f4724ed4795d12a05460619009ca8faa929e9a71d9e0a145cd1b
|
7
|
+
data.tar.gz: eae98b2731f31139802fd2ea7a2bd850332610d22ff587776fe6802e8fbfeadf00beded84f32ae32bb432dfd3858c8034a642fc008e2ae0b2dfaa6478996534b
|
data/lib/nx-real-ip.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require_relative "./nx/version"
|
2
|
+
require_relative "./nx/real-ip"
|
data/lib/nx/real-ip.rb
CHANGED
@@ -1,16 +1,26 @@
|
|
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
|
-
def get(args = { timeout: 5, proxy: nil })
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
def self.get(args = { timeout: 5, proxy: nil })
|
8
|
+
begin
|
9
|
+
real_ip = open(
|
10
|
+
"http://icanhazip.com/",
|
11
|
+
read_timeout: args[:timeout],
|
12
|
+
open_timeout: args[:timeout],
|
13
|
+
proxy: args[:proxy],
|
14
|
+
).read
|
12
15
|
|
13
|
-
|
16
|
+
if RE_IP_ADDRESS.match? real_ip
|
17
|
+
return real_ip.strip
|
18
|
+
else
|
19
|
+
nil
|
20
|
+
end
|
21
|
+
rescue Exception => e
|
22
|
+
end
|
23
|
+
nil
|
14
24
|
end
|
15
25
|
end
|
16
26
|
end
|
data/lib/nx/version.rb
CHANGED
Binary file
|
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,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nx-real-ip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- afeiship
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -60,8 +60,10 @@ 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.
|
63
|
+
- nx-real-ip-0.1.4.gem
|
64
|
+
- nx-real-ip-0.1.5.gem
|
64
65
|
- nx-real-ip.gemspec
|
66
|
+
- package.json
|
65
67
|
homepage: https://github.com/afeiship/nx-real-ip
|
66
68
|
licenses:
|
67
69
|
- MIT
|
@@ -81,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
83
|
- !ruby/object:Gem::Version
|
82
84
|
version: '0'
|
83
85
|
requirements: []
|
84
|
-
rubygems_version: 3.
|
86
|
+
rubygems_version: 3.0.3
|
85
87
|
signing_key:
|
86
88
|
specification_version: 4
|
87
89
|
summary: Get real ip.
|
data/nx-real-ip-0.1.0.gem
DELETED
Binary file
|