module IpHelper

亚洲最新ip地址 ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest

Public Instance Methods

read(name) click to toggle source
# File lib/rails_com/utils/ip_helper.rb, line 8
def read(name)
  IO.foreach(name) do |x|
    if x.match? /apnic\|CN\|ipv4/
      r = x.split('|').values_at(3, 4)
      int_min = IPAddr.new(r[0]).to_i
      int_max = min + r[1].to_i - 1
      ip_max = IPAddr.new(max, Socket::AF_INET).to_s

      [r[0], ip_max, int_min, int_max]
    end
  end
end