ipip 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ipip/ipv4_database_x.rb +2 -2
- data/lib/ipip/test.rb +12 -0
- data/lib/ipip/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fceece4105bab077bd57c187a947c84553eb8e53
|
4
|
+
data.tar.gz: 9b601dc2136f172c3028f1a3fcd48ba87d2e8677
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6d69ef9ba54b88b838afbfba8def0d49aa1a5f77a675026abb37b19ad269c6200fe474bbbaf3bdb15c6f3f2355416183ea4078976c1f82e5db39be8e9e2d95e
|
7
|
+
data.tar.gz: 88a511c257f3da831957ca01e7c049fe1ed14f82bc1122ed632f411698c48e773f5c32c0c8166fc38489215a690cb43c1fca0656bed8608e6bb7b7f153358ff9
|
data/lib/ipip/ipv4_database_x.rb
CHANGED
@@ -57,8 +57,8 @@ module IPIPX
|
|
57
57
|
|
58
58
|
start = unpack_V(buffer[first_ip_offset, 4])
|
59
59
|
start_offset = start * IP_BLOCK_SIZE + FIRST_IP_NUMBER_INDEX_SIZE
|
60
|
-
|
61
|
-
lo, hi = 0, (
|
60
|
+
end_offset = offset - FIRST_IP_NUMBER_INDEX_SIZE - OFFSET_NUMBER_SIZE
|
61
|
+
lo, hi = 0, (end_offset - start_offset) / IP_BLOCK_SIZE
|
62
62
|
|
63
63
|
while lo < hi
|
64
64
|
mid = (lo + hi) / 2
|
data/lib/ipip/test.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require './ipv4_database_x'
|
2
|
+
|
3
|
+
|
4
|
+
db = IPIPX::IPv4DatabaseX.new('/Users/liluo/github/ipip.datx')
|
5
|
+
|
6
|
+
puts db.find('223.155.165.74')
|
7
|
+
puts "-------------------"
|
8
|
+
puts db.find('210.155.165.74')
|
9
|
+
puts "-------------------"
|
10
|
+
puts db.find('114.155.165.77')
|
11
|
+
puts db.find('223.104.5.227')
|
12
|
+
puts db.find('223.211.233.221')
|
data/lib/ipip/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ipip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- liluo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -50,6 +50,7 @@ files:
|
|
50
50
|
- lib/ipip/17monipdb.dat
|
51
51
|
- lib/ipip/ipv4_database.rb
|
52
52
|
- lib/ipip/ipv4_database_x.rb
|
53
|
+
- lib/ipip/test.rb
|
53
54
|
- lib/ipip/version.rb
|
54
55
|
homepage: https://github.com/liluo/ipip
|
55
56
|
licenses:
|
@@ -71,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
72
|
version: '0'
|
72
73
|
requirements: []
|
73
74
|
rubyforge_project:
|
74
|
-
rubygems_version: 2.
|
75
|
+
rubygems_version: 2.6.10
|
75
76
|
signing_key:
|
76
77
|
specification_version: 4
|
77
78
|
summary: IP search based on ipip.net
|