search_apnic 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 28666d6d9e1437dc2da807e1441b7299d9eb64dd
4
- data.tar.gz: 3e65d4a8a824a0648c4f71c5f39303ba8900e3b5
3
+ metadata.gz: 191977a138a6f425d048214cf3da70330493a3c1
4
+ data.tar.gz: adaa674c87f588d7a36558ebb033c08e77b8a6db
5
5
  SHA512:
6
- metadata.gz: b26631fe6f47bdc0bbda771dd1768a451b617ba8cf00fc8e22f162e4624d66554ff70a36411834e01604dac07d5d739ef5fe9660ce79995189969634c7ef2137
7
- data.tar.gz: e169705cc6fb74aa7fc79de0bbca2ad7009f2eab43708e63c8c59831569f8e0743614fc2208e55802c6454cd50a4e1e9f5cb04ac95ee05a03ccda9e66054096f
6
+ metadata.gz: 8323ab74713d9b208e58d955e679353972520881293a3ec1b65c801e7c1998d0ec981473650313bd289e609da2cad482ef73f1e4c01136454bd0f1dbb18e2b05
7
+ data.tar.gz: 2bb7d754e43106e08dd691f95cfde4f2cb0408c4a5edb9ea30456eb452709d1eebaf06ca9c9d3633ddc149972680d1fb482fba360ff5ab9e7cb61a3516fc1347
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # SearchApnic
2
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/search_apnic`. 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
3
+ SearchApnic will seach the IP address of each country from APNIC: http://ftp.apnic.net/stats/apnic/delegated-apnic-latest.
4
+ and displays it in xxx.xxx.xxx.xxx/mask format.
6
5
 
7
6
  ## Installation
8
7
 
@@ -22,7 +21,50 @@ Or install it yourself as:
22
21
 
23
22
  ## Usage
24
23
 
25
- TODO: Write usage instructions here
24
+ ### Dump
25
+
26
+ ```
27
+ search_apnic -c 'JP' --dump
28
+ ```
29
+
30
+ 👇🏼
31
+
32
+ ```
33
+ 1.0.16.0/21
34
+ 1.0.64.0/19
35
+ 1.1.64.0/19
36
+ 1.5.0.0/17
37
+ 1.21.0.0/17
38
+ 1.33.0.0/17
39
+ 1.66.0.0/16
40
+ ......
41
+ ```
42
+
43
+ ### Seach
44
+
45
+
46
+ #### Found.
47
+
48
+ ```
49
+ search_apnic -c 'JP' -i '1.0.16.10'
50
+ ```
51
+
52
+ 👇🏼
53
+
54
+ ```
55
+ 1.0.16.0/21
56
+ ```
57
+
58
+ #### Not Found.
59
+
60
+ ```
61
+ search_apnic -c 'JP' -i '1.0.116.0'
62
+ ```
63
+ 👇🏼
64
+ ```
65
+ Not Match
66
+ ```
67
+
26
68
 
27
69
  ## Development
28
70
 
@@ -87,7 +87,7 @@ module SearchApnic
87
87
  @records ||= []
88
88
  number_of_ip = record[:value].to_i
89
89
  start = record[:start]
90
- mask = 33 - ("%b" % number_of_ip).length + 1
90
+ mask = 32 - ("%b" % number_of_ip).length + 1
91
91
  ip = "#{start}/#{mask}"
92
92
 
93
93
  @records << ip
@@ -1,3 +1,3 @@
1
1
  module SearchApnic
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: search_apnic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - hiroshi kobayashi