ip_locator_cn 0.1.0
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 +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +35 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/data/qqwry.dat +0 -0
- data/ip_locator_cn.gemspec +42 -0
- data/lib/ip_locator_cn.rb +21 -0
- data/lib/ip_locator_cn/qqwry.rb +287 -0
- data/lib/ip_locator_cn/qqwry/city_directly.rb +10 -0
- data/lib/ip_locator_cn/qqwry/isp.rb +12 -0
- data/lib/ip_locator_cn/qqwry/provinces.rb +40 -0
- data/lib/ip_locator_cn/version.rb +3 -0
- metadata +105 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3a6d59b99c393a70bc272fb7d6a9af22488f358aff70803fa8edc5ef6a2cd1bc
|
4
|
+
data.tar.gz: 3f35ee0f891112133baa58a3938e6d2a199296e40bf21c442b34204dd49ecdf2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2bea475014d0f4ad880129b10a8c39dd6e1f930ea4ce92892713bef024160f0ef8ad7804011807bff06b403fbf1dcff27a27b74cd9f471377a0d206002f04fb9
|
7
|
+
data.tar.gz: d3847a4a344ae42069c5f4a981d21169fdeb231c4b332e606f864efe5b60779c5f76903e7380f1c1605e6524953fe8a346bfaca344f17a95da4ee850456e6a62
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ip_locator_cn (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.3)
|
10
|
+
rake (10.5.0)
|
11
|
+
rspec (3.8.0)
|
12
|
+
rspec-core (~> 3.8.0)
|
13
|
+
rspec-expectations (~> 3.8.0)
|
14
|
+
rspec-mocks (~> 3.8.0)
|
15
|
+
rspec-core (3.8.0)
|
16
|
+
rspec-support (~> 3.8.0)
|
17
|
+
rspec-expectations (3.8.2)
|
18
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
+
rspec-support (~> 3.8.0)
|
20
|
+
rspec-mocks (3.8.0)
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
+
rspec-support (~> 3.8.0)
|
23
|
+
rspec-support (3.8.0)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
bundler (~> 1.16)
|
30
|
+
ip_locator_cn!
|
31
|
+
rake (~> 10.0)
|
32
|
+
rspec (~> 3.0)
|
33
|
+
|
34
|
+
BUNDLED WITH
|
35
|
+
1.16.6
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 xiaohui
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# IpLocatorCn
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ip_locator_cn`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'ip_locator_cn'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install ip_locator_cn
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/xiaohui-zhangxh/ip_locator_cn.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "ip_locator_cn"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/data/qqwry.dat
ADDED
Binary file
|
@@ -0,0 +1,42 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "ip_locator_cn/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "ip_locator_cn"
|
8
|
+
spec.version = IpLocatorCn::VERSION
|
9
|
+
spec.authors = ["xiaohui"]
|
10
|
+
spec.email = ["xiaohui@tanmer.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Resolve IP info in China}
|
13
|
+
spec.description = %q{Resolve IP with qqwry.data, can download qqwry.data on the air.}
|
14
|
+
spec.homepage = "https://github.com/xiaohui-zhangxh/"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
|
22
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
23
|
+
# spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
|
24
|
+
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
25
|
+
else
|
26
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
27
|
+
"public gem pushes."
|
28
|
+
end
|
29
|
+
|
30
|
+
# Specify which files should be added to the gem when it is released.
|
31
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
32
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
33
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
34
|
+
end
|
35
|
+
spec.bindir = "exe"
|
36
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
37
|
+
spec.require_paths = ["lib"]
|
38
|
+
|
39
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
40
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
41
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
42
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "ip_locator_cn/version"
|
2
|
+
require 'ip_locator_cn/qqwry'
|
3
|
+
module IpLocatorCn
|
4
|
+
# embeded qqwry.dat
|
5
|
+
def self.data_path
|
6
|
+
File.expand_path('../../data/qqwry.dat', __FILE__)
|
7
|
+
end
|
8
|
+
|
9
|
+
# download url for qqwry.rar (uncracked)
|
10
|
+
def self.live_data_url
|
11
|
+
'http://update.cz88.net/ip/qqwry.rar'
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.copywrite_url
|
15
|
+
'http://update.cz88.net/ip/copywrite.rar'
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.resolve(ip)
|
19
|
+
QQWry.new(dat_path: data_path).resolve(ip)
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,287 @@
|
|
1
|
+
require 'ip_locator_cn/qqwry/provinces'
|
2
|
+
require 'ip_locator_cn/qqwry/city_directly'
|
3
|
+
require 'ip_locator_cn/qqwry/isp'
|
4
|
+
|
5
|
+
module IpLocatorCn
|
6
|
+
class QQWry
|
7
|
+
IP_ENTRY_BYTES = 7.freeze
|
8
|
+
|
9
|
+
attr_reader :first_ip_pos, :last_ip_pos, :total_ips, :debug
|
10
|
+
|
11
|
+
def initialize(dat_path: nil, live_dat: false, debug: false)
|
12
|
+
@debug = debug
|
13
|
+
if live_dat
|
14
|
+
live_load_dat
|
15
|
+
parse_dat_info
|
16
|
+
elsif dat_path
|
17
|
+
@io = File.open(dat_path, 'rb')
|
18
|
+
parse_dat_info
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# return: <Hash> result
|
23
|
+
# result['ip'] 输入的ip
|
24
|
+
# result['country'] 国家 如 中国
|
25
|
+
# result['province'] 省份信息 如 河北省
|
26
|
+
# result['city'] 市区 如 邢台市
|
27
|
+
# result['county'] 郡县 如 威县
|
28
|
+
# result['isp'] 运营商 如 联通
|
29
|
+
# result['area'] 最完整的信息 如 中国河北省邢台市威县新科网吧(北外街)
|
30
|
+
def resolve(ip)
|
31
|
+
location = location_from_ip(ip)
|
32
|
+
extract_location(location[:country]).tap do |result|
|
33
|
+
result[:ip] = ip
|
34
|
+
result[:country] ||= ''
|
35
|
+
result[:province] ||= ''
|
36
|
+
result[:city] ||= ''
|
37
|
+
result[:county] ||= ''
|
38
|
+
result[:isp] = get_isp(location[:area]) || ''
|
39
|
+
result[:area] = [
|
40
|
+
result[:country],
|
41
|
+
result[:province],
|
42
|
+
result[:city],
|
43
|
+
result[:county],
|
44
|
+
location[:area]
|
45
|
+
].join
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def location_from_ip(ip)
|
50
|
+
info = {}
|
51
|
+
pos = locate_ip_pos(ip)
|
52
|
+
log "pos is #{pos}"
|
53
|
+
# 用户IP所在范围的开始地址
|
54
|
+
seek(pos)
|
55
|
+
begin_ip = long2ip(read_ip())
|
56
|
+
log "begin_ip is #{begin_ip}"
|
57
|
+
# 用户IP所在范围的结束地址
|
58
|
+
offset = getlong3()
|
59
|
+
seek(offset)
|
60
|
+
endip = long2ip(read_ip())
|
61
|
+
log "endip is #{endip}"
|
62
|
+
log "offset is #{offset}"
|
63
|
+
byte = read(1) # 标志字节
|
64
|
+
case byte.ord
|
65
|
+
when 1
|
66
|
+
# 标志字节为1,表示国家和区域信息都被同时重定向
|
67
|
+
country_offset = getlong3() # 重定向地址
|
68
|
+
seek(country_offset)
|
69
|
+
byte = read(1) # 标志字节
|
70
|
+
case byte.ord
|
71
|
+
when 2
|
72
|
+
seek(getlong3)
|
73
|
+
info[:country] = getstring()
|
74
|
+
seek(country_offset + 4)
|
75
|
+
info[:area] = getarea()
|
76
|
+
else
|
77
|
+
info[:country] = getstring(byte)
|
78
|
+
info[:area] = getarea()
|
79
|
+
end
|
80
|
+
when 2
|
81
|
+
# 标志字节为2,表示国家信息被重定向
|
82
|
+
seek(getlong3)
|
83
|
+
info[:country] = getstring()
|
84
|
+
seek(offset + 8)
|
85
|
+
info[:area] = getarea()
|
86
|
+
else
|
87
|
+
info[:country] = getstring(byte)
|
88
|
+
info[:area] = getarea()
|
89
|
+
end
|
90
|
+
|
91
|
+
info[:country] = encoding_convert(info[:country])
|
92
|
+
info[:area] = encoding_convert(info[:area])
|
93
|
+
|
94
|
+
log "country is #{info[:country]}"
|
95
|
+
log "area is #{info[:area]}"
|
96
|
+
|
97
|
+
if info[:country] == ' CZ88.NET' || info[:country] == '纯真网络'
|
98
|
+
info[:country] = 'Unknown'
|
99
|
+
end
|
100
|
+
|
101
|
+
info[:area] = '' if info[:area] == ' CZ88.NET'
|
102
|
+
|
103
|
+
info
|
104
|
+
end
|
105
|
+
|
106
|
+
# 提取 四川省成都市高新区 => 中国 四川 成都市 高新区
|
107
|
+
def extract_location(str)
|
108
|
+
collection = {}
|
109
|
+
seperator_sheng = '省'
|
110
|
+
seperator_shi = '市'
|
111
|
+
seperator_xian = '县'
|
112
|
+
seperator_qu = '区'
|
113
|
+
is_city_directly = false
|
114
|
+
|
115
|
+
# 省份
|
116
|
+
if str.include?(seperator_sheng)
|
117
|
+
collection[:province], str = str.split(seperator_sheng, 2)
|
118
|
+
else
|
119
|
+
province = (PROVINCES + CITY_DIRECTLY).find{ |x| str.start_with?(x) }
|
120
|
+
if x
|
121
|
+
collection[:province] = province
|
122
|
+
is_city_directly = CITY_DIRECTLY.include?(province)
|
123
|
+
str = str[province.length..-1]
|
124
|
+
str = str[1..-1] if str.start_with?(seperator_shi) # 上海市浦东区 => [上海, 市浦东区] => [上海, 浦东区]
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
return { country: str } unless collection.key?(:province)
|
129
|
+
|
130
|
+
# 市
|
131
|
+
if str.include?(seperator_shi)
|
132
|
+
collection[:city], str = str.split(seperator_shi, 2)
|
133
|
+
collection[:city] += seperator_shi
|
134
|
+
end
|
135
|
+
|
136
|
+
# 县
|
137
|
+
if str.include?(seperator_xian)
|
138
|
+
collection[:county], str = str.split(seperator_xian, 2)
|
139
|
+
collection[:county] += seperator_xian
|
140
|
+
end
|
141
|
+
|
142
|
+
# 区
|
143
|
+
if !collection.key?(:county) && str.include?(seperator_qu)
|
144
|
+
collection[:county], str = str.split(seperator_qu, 2)
|
145
|
+
collection[:county] += seperator_qu
|
146
|
+
if is_city_directly
|
147
|
+
collection[:city] = collection[:county]
|
148
|
+
collection.delete(:county)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
collection[:country] = '中国'
|
153
|
+
collection
|
154
|
+
end
|
155
|
+
|
156
|
+
private
|
157
|
+
|
158
|
+
def download(url)
|
159
|
+
log "downloading #{url}"
|
160
|
+
open(url)
|
161
|
+
end
|
162
|
+
|
163
|
+
def live_load_dat
|
164
|
+
require 'open-uri'
|
165
|
+
copywrite = download(IpLocatorCn.copywrite_url).read and nil
|
166
|
+
qqwry = download(IpLocatorCn.live_data_url).read.bytes and nil
|
167
|
+
key = copywrite.unpack('V6')[5]
|
168
|
+
log "qqwry decoding key is #{key}"
|
169
|
+
(0...0x200).each do |i|
|
170
|
+
key *= 0x805
|
171
|
+
key += 1
|
172
|
+
key &= 0xFF
|
173
|
+
qqwry[i] ^= key
|
174
|
+
end
|
175
|
+
qqwry = Zlib::Inflate.inflate(qqwry.pack('C*')) and nil
|
176
|
+
@io = StringIO.new(qqwry)
|
177
|
+
end
|
178
|
+
|
179
|
+
def parse_dat_info
|
180
|
+
@first_ip_pos = getlong4()
|
181
|
+
@last_ip_pos = getlong4()
|
182
|
+
@total_ips = (last_ip_pos - first_ip_pos) / IP_ENTRY_BYTES
|
183
|
+
log "total ip ranges: #{total_ips}"
|
184
|
+
end
|
185
|
+
|
186
|
+
def get_isp(str)
|
187
|
+
ISP.find {|x| str.include?(x)}
|
188
|
+
end
|
189
|
+
|
190
|
+
# b-tree search ip from qqwry.dat
|
191
|
+
def locate_ip_pos(ip)
|
192
|
+
x = ip2long(ip)
|
193
|
+
min, max = 0, total_ips
|
194
|
+
|
195
|
+
while min <= max
|
196
|
+
# b-tree search
|
197
|
+
i = ((min + max) / 2).floor
|
198
|
+
pos = first_ip_pos + i * IP_ENTRY_BYTES
|
199
|
+
seek(pos)
|
200
|
+
# get middle ip
|
201
|
+
y = read_ip()
|
202
|
+
if x < y
|
203
|
+
# user ip < middle ip
|
204
|
+
max = i - 1
|
205
|
+
else
|
206
|
+
# user ip > middle ip, read next ip entry
|
207
|
+
read(3)
|
208
|
+
y = read_ip()
|
209
|
+
if x > y
|
210
|
+
# user ip > next ip
|
211
|
+
min = i + 1
|
212
|
+
else
|
213
|
+
return pos
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
-1
|
218
|
+
end
|
219
|
+
|
220
|
+
def seek(n)
|
221
|
+
@io.seek(n)
|
222
|
+
end
|
223
|
+
|
224
|
+
def read(n)
|
225
|
+
@io.read(n)
|
226
|
+
end
|
227
|
+
|
228
|
+
def read_ip
|
229
|
+
ipparts2long(read(4).reverse.bytes)
|
230
|
+
end
|
231
|
+
|
232
|
+
def getlong4
|
233
|
+
read(4).unpack('V')[0]
|
234
|
+
end
|
235
|
+
|
236
|
+
def getlong3
|
237
|
+
(read(3) + "\0").unpack('V')[0]
|
238
|
+
end
|
239
|
+
|
240
|
+
def ip2long(ip)
|
241
|
+
parts = ip.split('.').map(&:to_i)
|
242
|
+
ipparts2long(parts)
|
243
|
+
end
|
244
|
+
|
245
|
+
def ipparts2long(parts)
|
246
|
+
0.upto(3).map{|i| parts[i] << ((3 - i) * 8) }.sum
|
247
|
+
end
|
248
|
+
|
249
|
+
def long2ip(n)
|
250
|
+
0.upto(3).map{|i| (n >> ((3 - i) * 8)) & 0xFF }.join('.')
|
251
|
+
end
|
252
|
+
|
253
|
+
def getstring(data='')
|
254
|
+
char = read(1)
|
255
|
+
while char.ord > 0
|
256
|
+
data += char
|
257
|
+
char = read(1)
|
258
|
+
end
|
259
|
+
|
260
|
+
data
|
261
|
+
end
|
262
|
+
|
263
|
+
def getarea
|
264
|
+
char = read(1)
|
265
|
+
case char.ord
|
266
|
+
when 0
|
267
|
+
return ''
|
268
|
+
when 1, 2
|
269
|
+
seek(getlong3)
|
270
|
+
return getstring()
|
271
|
+
else
|
272
|
+
return getstring(char)
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
def encoding_convert(str)
|
277
|
+
ec = Encoding::Converter.new("GBK", "UTF-8")
|
278
|
+
result = ec.convert(str)
|
279
|
+
ec.finish
|
280
|
+
result
|
281
|
+
end
|
282
|
+
|
283
|
+
def log(msg)
|
284
|
+
puts "[#{Time.now}] => #{msg}" if debug
|
285
|
+
end
|
286
|
+
end
|
287
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module IpLocatorCn
|
2
|
+
class QQWry
|
3
|
+
PROVINCES = [
|
4
|
+
'北京',
|
5
|
+
'天津',
|
6
|
+
'重庆',
|
7
|
+
'上海',
|
8
|
+
'河北',
|
9
|
+
'山西',
|
10
|
+
'辽宁',
|
11
|
+
'吉林',
|
12
|
+
'黑龙江',
|
13
|
+
'江苏',
|
14
|
+
'浙江',
|
15
|
+
'安徽',
|
16
|
+
'福建',
|
17
|
+
'江西',
|
18
|
+
'山东',
|
19
|
+
'河南',
|
20
|
+
'湖北',
|
21
|
+
'湖南',
|
22
|
+
'广东',
|
23
|
+
'海南',
|
24
|
+
'四川',
|
25
|
+
'贵州',
|
26
|
+
'云南',
|
27
|
+
'陕西',
|
28
|
+
'甘肃',
|
29
|
+
'青海',
|
30
|
+
'台湾',
|
31
|
+
'内蒙古',
|
32
|
+
'广西',
|
33
|
+
'宁夏',
|
34
|
+
'新疆',
|
35
|
+
'西藏',
|
36
|
+
'香港',
|
37
|
+
'澳门',
|
38
|
+
].freeze
|
39
|
+
end
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ip_locator_cn
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- xiaohui
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-02-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: Resolve IP with qqwry.data, can download qqwry.data on the air.
|
56
|
+
email:
|
57
|
+
- xiaohui@tanmer.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- Gemfile
|
66
|
+
- Gemfile.lock
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bin/console
|
71
|
+
- bin/setup
|
72
|
+
- data/qqwry.dat
|
73
|
+
- ip_locator_cn.gemspec
|
74
|
+
- lib/ip_locator_cn.rb
|
75
|
+
- lib/ip_locator_cn/qqwry.rb
|
76
|
+
- lib/ip_locator_cn/qqwry/city_directly.rb
|
77
|
+
- lib/ip_locator_cn/qqwry/isp.rb
|
78
|
+
- lib/ip_locator_cn/qqwry/provinces.rb
|
79
|
+
- lib/ip_locator_cn/version.rb
|
80
|
+
homepage: https://github.com/xiaohui-zhangxh/
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata:
|
84
|
+
homepage_uri: https://github.com/xiaohui-zhangxh/
|
85
|
+
post_install_message:
|
86
|
+
rdoc_options: []
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
requirements: []
|
100
|
+
rubyforge_project:
|
101
|
+
rubygems_version: 2.7.8
|
102
|
+
signing_key:
|
103
|
+
specification_version: 4
|
104
|
+
summary: Resolve IP info in China
|
105
|
+
test_files: []
|