nx-real-ip 0.1.4 → 0.1.5
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 +14 -10
- data/lib/nx/version.rb +1 -1
- data/nx-real-ip-0.1.4.gem +0 -0
- metadata +2 -2
- data/nx-real-ip-0.1.3.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: 35f81a971280dacd08159f43f8b72819fd9624525b9bed49b80da6cc90f68dd8
|
4
|
+
data.tar.gz: b0e846320d92031f223e9e9640d3f5d230a39e687ab24ac81d3fd420e3103148
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9eec9c6ade341f05704b54a15843ca2690f76daa0565ab966b69a50fedc3825b8300ae0e2be01423187f243416369811bfa5ca5db199ddb9280c45e37d579584
|
7
|
+
data.tar.gz: 89155b31d9af9d2e63fcd8f73185003c4ad86e74132990ad7cc4fefce1958f46f5223eb65bd38412712801684500671e39dc20f3e7bf5c7b9b339aa80c992f98
|
data/lib/nx/real-ip.rb
CHANGED
@@ -5,18 +5,22 @@ RE_IP_ADDRESS = /\b\d+\.\d+\.\d+\.\d+\b/
|
|
5
5
|
module Nx
|
6
6
|
class RealIp
|
7
7
|
def self.get(args = { timeout: 5, proxy: nil })
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
if RE_IP_ADDRESS.match? real_ip
|
17
|
+
return real_ip.strip
|
18
|
+
else
|
19
|
+
nil
|
20
|
+
end
|
21
|
+
rescue Exception => e
|
19
22
|
end
|
23
|
+
nil
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
data/lib/nx/version.rb
CHANGED
Binary file
|
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.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- afeiship
|
@@ -60,7 +60,7 @@ 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
64
|
- nx-real-ip.gemspec
|
65
65
|
- package.json
|
66
66
|
homepage: https://github.com/afeiship/nx-real-ip
|
data/nx-real-ip-0.1.3.gem
DELETED
Binary file
|