xiaohui-zhangxh/ip_locator_cn

View on GitHub
lib/ip_locator_cn.rb

Summary

Maintainability
A
0 mins
Test Coverage
require 'ip_locator_cn/version'
require 'ip_locator_cn/qqwry'

module IpLocatorCn
  # embeded qqwry.dat
  def self.data_path
    File.expand_path('../../data/qqwry.dat', __FILE__)
  end

  # download url for qqwry.rar (uncracked)
  def self.live_data_url
    'http://update.cz88.net/ip/qqwry.rar'
  end

  def self.copywrite_url
    'http://update.cz88.net/ip/copywrite.rar'
  end

  def self.resolve(ip, options={ dat_path: data_path })
    QQWry.new(**options).resolve(ip)
  end
end