nx-real-ip 0.1.4 → 0.1.5

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: dcf5c22f2009789090e6e52d6046a871b7917e8e341f698d7a2ff43024839132
4
- data.tar.gz: 3a61e74bdcf0bb9ce8ef71d13bd6e090d689730f03fbe3263a45770ef445445c
3
+ metadata.gz: 35f81a971280dacd08159f43f8b72819fd9624525b9bed49b80da6cc90f68dd8
4
+ data.tar.gz: b0e846320d92031f223e9e9640d3f5d230a39e687ab24ac81d3fd420e3103148
5
5
  SHA512:
6
- metadata.gz: a11fb0894a94e8f96f229793251cea81db1cd7366e9e7319e6211da8e5e543a3c560698535dbc874d9c6c03e1f43dcd27d2b8e6313b8fdd83020fe8fa02e0776
7
- data.tar.gz: 9c7e497623d1becbeba9c2f83a4a8dbdd18a09646d1aeeefd0a009017ac360a229114912f617d9b00d30d42e1b630596558eb42519099eaed69fa2fc40718de3
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
- real_ip = open(
9
- "http://icanhazip.com/",
10
- read_timeout: args[:timeout],
11
- open_timeout: args[:timeout],
12
- proxy: args[:proxy],
13
- ).read
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
- if RE_IP_ADDRESS.match? real_ip
16
- real_ip.strip
17
- else
18
- nil
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
@@ -1,5 +1,5 @@
1
1
  module Nx
2
2
  class RealIp
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  end
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
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.3.gem
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