class Nx::RealIp
Constants
- VERSION
Public Class Methods
get(args = { timeout: 5, proxy: nil })
click to toggle source
# File lib/nx/real-ip.rb, line 7 def self.get(args = { timeout: 5, proxy: nil }) begin real_ip = open( "http://icanhazip.com/", read_timeout: args[:timeout], open_timeout: args[:timeout], proxy: args[:proxy], ).read if RE_IP_ADDRESS.match? real_ip return real_ip.strip else nil end rescue Exception => e end nil end