@ayesh/geo-ip-database 1.0.20210117 → 1.1.20230811

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.
Files changed (216) hide show
  1. package/.gitattributes +11 -11
  2. package/.github/workflows/ci.yml +24 -32
  3. package/README.md +35 -3
  4. package/composer.json +15 -0
  5. package/data/1.json +21 -104
  6. package/data/100.json +1 -13
  7. package/data/101.json +56 -179
  8. package/data/102.json +837 -394
  9. package/data/103.json +4830 -3915
  10. package/data/104.json +6601 -3110
  11. package/data/105.json +27 -160
  12. package/data/106.json +1 -34
  13. package/data/107.json +213 -660
  14. package/data/108.json +130 -193
  15. package/data/109.json +393 -597
  16. package/data/11.json +5 -3
  17. package/data/110.json +69 -64
  18. package/data/111.json +72 -121
  19. package/data/112.json +15 -56
  20. package/data/113.json +90 -144
  21. package/data/114.json +79 -69
  22. package/data/115.json +46 -60
  23. package/data/116.json +52 -133
  24. package/data/117.json +14 -83
  25. package/data/118.json +68 -180
  26. package/data/119.json +100 -235
  27. package/data/12.json +23 -108
  28. package/data/120.json +15 -79
  29. package/data/121.json +50 -52
  30. package/data/122.json +67 -271
  31. package/data/123.json +30 -41
  32. package/data/124.json +18 -105
  33. package/data/125.json +20 -108
  34. package/data/128.json +199 -332
  35. package/data/129.json +126 -253
  36. package/data/13.json +724 -289
  37. package/data/130.json +891 -400
  38. package/data/131.json +129 -370
  39. package/data/132.json +51 -498
  40. package/data/133.json +3 -17
  41. package/data/134.json +459 -577
  42. package/data/135.json +250 -230
  43. package/data/136.json +746 -331
  44. package/data/137.json +153 -467
  45. package/data/138.json +288 -621
  46. package/data/139.json +187 -273
  47. package/data/14.json +23 -42
  48. package/data/140.json +634 -131
  49. package/data/141.json +352 -481
  50. package/data/142.json +108 -258
  51. package/data/143.json +80 -273
  52. package/data/144.json +389 -666
  53. package/data/145.json +206 -440
  54. package/data/146.json +1368 -500
  55. package/data/147.json +590 -1013
  56. package/data/148.json +174 -334
  57. package/data/149.json +2535 -1575
  58. package/data/15.json +342 -177
  59. package/data/150.json +138 -366
  60. package/data/151.json +204 -450
  61. package/data/152.json +72 -202
  62. package/data/153.json +45 -156
  63. package/data/154.json +3123 -8421
  64. package/data/155.json +263 -329
  65. package/data/156.json +375 -4527
  66. package/data/157.json +434 -665
  67. package/data/158.json +179 -535
  68. package/data/159.json +183 -560
  69. package/data/16.json +52 -31
  70. package/data/160.json +122 -350
  71. package/data/161.json +2188 -468
  72. package/data/162.json +375 -839
  73. package/data/163.json +1438 -295
  74. package/data/164.json +194 -622
  75. package/data/165.json +1240 -576
  76. package/data/166.json +249 -201
  77. package/data/167.json +194 -469
  78. package/data/168.json +377 -744
  79. package/data/169.json +164 -579
  80. package/data/17.json +500 -722
  81. package/data/170.json +256 -693
  82. package/data/171.json +66 -99
  83. package/data/172.json +2566 -911
  84. package/data/173.json +268 -627
  85. package/data/174.json +25 -144
  86. package/data/175.json +35 -56
  87. package/data/176.json +461 -756
  88. package/data/177.json +26 -227
  89. package/data/178.json +496 -1194
  90. package/data/179.json +139 -491
  91. package/data/18.json +101 -29
  92. package/data/180.json +208 -340
  93. package/data/181.json +608 -693
  94. package/data/182.json +18 -113
  95. package/data/183.json +25 -46
  96. package/data/184.json +273 -568
  97. package/data/185.json +3932 -4083
  98. package/data/186.json +76 -228
  99. package/data/187.json +18 -112
  100. package/data/188.json +557 -849
  101. package/data/189.json +12 -93
  102. package/data/19.json +5 -23
  103. package/data/190.json +253 -958
  104. package/data/191.json +278 -823
  105. package/data/192.json +771 -5256
  106. package/data/193.json +2035 -3324
  107. package/data/194.json +1682 -2683
  108. package/data/195.json +1234 -2578
  109. package/data/196.json +1443 -2654
  110. package/data/197.json +26 -249
  111. package/data/198.json +336 -2316
  112. package/data/199.json +308 -1642
  113. package/data/2.json +1189 -550
  114. package/data/20.json +800 -300
  115. package/data/200.json +281 -975
  116. package/data/201.json +64 -257
  117. package/data/202.json +382 -1342
  118. package/data/203.json +406 -2165
  119. package/data/204.json +275 -1366
  120. package/data/205.json +222 -907
  121. package/data/206.json +455 -1025
  122. package/data/207.json +240 -781
  123. package/data/208.json +1005 -3268
  124. package/data/209.json +821 -1246
  125. package/data/21.json +1 -43
  126. package/data/210.json +142 -373
  127. package/data/211.json +16 -39
  128. package/data/212.json +3794 -2012
  129. package/data/213.json +1457 -2924
  130. package/data/215.json +3 -0
  131. package/data/216.json +599 -1045
  132. package/data/217.json +975 -1794
  133. package/data/218.json +6 -72
  134. package/data/219.json +0 -26
  135. package/data/22.json +1 -18
  136. package/data/220.json +5 -128
  137. package/data/221.json +20 -53
  138. package/data/222.json +0 -16
  139. package/data/223.json +34 -60
  140. package/data/23.json +2782 -4553
  141. package/data/24.json +127 -144
  142. package/data/25.json +5 -43
  143. package/data/27.json +69 -122
  144. package/data/3.json +59 -55
  145. package/data/31.json +723 -630
  146. package/data/32.json +339 -360
  147. package/data/34.json +429 -663
  148. package/data/35.json +50 -210
  149. package/data/36.json +12 -36
  150. package/data/37.json +472 -1059
  151. package/data/38.json +1501 -801
  152. package/data/39.json +2 -9
  153. package/data/4.json +186 -147
  154. package/data/40.json +777 -768
  155. package/data/41.json +130 -898
  156. package/data/42.json +7 -102
  157. package/data/43.json +322 -432
  158. package/data/44.json +66 -127
  159. package/data/45.json +3399 -5904
  160. package/data/46.json +741 -1326
  161. package/data/47.json +85 -408
  162. package/data/49.json +30 -104
  163. package/data/5.json +1115 -2464
  164. package/data/50.json +79 -278
  165. package/data/51.json +1043 -2236
  166. package/data/52.json +1324 -1362
  167. package/data/53.json +1 -23
  168. package/data/54.json +285 -729
  169. package/data/56.json +7 -3
  170. package/data/57.json +222 -409
  171. package/data/58.json +11 -52
  172. package/data/59.json +10 -52
  173. package/data/60.json +2 -37
  174. package/data/61.json +52 -194
  175. package/data/62.json +1304 -2513
  176. package/data/63.json +158 -1000
  177. package/data/64.json +796 -1483
  178. package/data/65.json +473 -740
  179. package/data/66.json +535 -950
  180. package/data/67.json +471 -457
  181. package/data/68.json +71 -142
  182. package/data/69.json +308 -1180
  183. package/data/7.json +1 -23
  184. package/data/70.json +92 -120
  185. package/data/71.json +9 -23
  186. package/data/72.json +312 -363
  187. package/data/73.json +4 -23
  188. package/data/74.json +717 -409
  189. package/data/75.json +36 -123
  190. package/data/76.json +392 -58
  191. package/data/77.json +579 -814
  192. package/data/78.json +178 -438
  193. package/data/79.json +1089 -204
  194. package/data/8.json +837 -527
  195. package/data/80.json +1038 -1963
  196. package/data/81.json +220 -584
  197. package/data/82.json +236 -622
  198. package/data/83.json +249 -557
  199. package/data/84.json +900 -1239
  200. package/data/85.json +629 -788
  201. package/data/86.json +184 -254
  202. package/data/87.json +388 -500
  203. package/data/88.json +609 -386
  204. package/data/89.json +1244 -1032
  205. package/data/9.json +7 -3
  206. package/data/90.json +80 -361
  207. package/data/91.json +1209 -1923
  208. package/data/92.json +781 -931
  209. package/data/93.json +355 -651
  210. package/data/94.json +774 -907
  211. package/data/95.json +626 -743
  212. package/data/96.json +206 -212
  213. package/data/97.json +3 -44
  214. package/data/98.json +217 -293
  215. package/data/99.json +48 -111
  216. package/package.json +5 -1
package/.gitattributes CHANGED
@@ -1,11 +1,11 @@
1
- # https://php.watch/articles/composer-gitattributes
2
-
3
- # Exclude build/test files from archive
4
- /.github export-ignore
5
- /.gitattributes export-ignore
6
- /.gitignore export-ignore
7
- /.npmignore export-ignore
8
-
9
- # Configure diff output for .php and .phar files.
10
- *.php diff=php
11
- *.phar -diff
1
+ # https://php.watch/articles/composer-gitattributes
2
+
3
+ # Exclude build/test files from archive
4
+ /.github export-ignore
5
+ /.gitattributes export-ignore
6
+ /.gitignore export-ignore
7
+ /.npmignore export-ignore
8
+
9
+ # Configure diff output for .php and .phar files.
10
+ *.php diff=php
11
+ *.phar -diff
@@ -1,49 +1,36 @@
1
1
  name: Update GeoIP Database
2
- on: [push]
2
+ on:
3
+ workflow_dispatch:
4
+ schedule:
5
+ - cron: '5 4 */3 * *'
3
6
 
4
7
  jobs:
5
8
  build:
6
9
 
7
10
  strategy:
8
11
  matrix:
9
- php-versions: ['8.0']
10
- runs-on: ubuntu-20.04
12
+ php-versions: ['8.2']
13
+ runs-on: ubuntu-latest
11
14
 
12
15
  steps:
13
16
 
14
17
  - name: Checkout
15
- uses: actions/checkout@v2
18
+ uses: actions/checkout@v3
16
19
  with:
17
20
  ref: ${{ github.head_ref }}
18
21
 
19
22
 
20
23
  - name: Setup PHP, with composer and extensions
21
- uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
24
+ uses: shivammathur/setup-php@v2
22
25
  with:
23
26
  php-version: ${{ matrix.php-versions }}
24
27
 
25
-
26
- - name: Get composer cache directory
27
- id: composer-cache
28
- run: echo "::set-output name=dir::$(composer config cache-files-dir)"
29
-
30
-
31
- - name: Cache composer dependencies
32
- uses: actions/cache@v2
33
- with:
34
- path: ${{ steps.composer-cache.outputs.dir }}
35
- # Use composer.json for key, if composer.lock is not committed.
36
- # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
37
- key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
38
- restore-keys: ${{ runner.os }}-composer-
39
-
40
-
41
28
  - name: Install dependencies
42
29
  run: |
30
+ git config --global --add safe.directory /github/workspace
43
31
  rm -rf vendor/bin
44
32
  composer install --no-progress --prefer-dist
45
33
 
46
-
47
34
  - name: Download and setup database
48
35
  run: |
49
36
  mkdir input
@@ -53,31 +40,36 @@ jobs:
53
40
  mv input/*/*.csv input/ -f
54
41
  ls input
55
42
 
56
-
57
43
  - name: Process database
58
44
  run: |
45
+ git config --global --add safe.directory '*'
59
46
  php vendor/ayesh/geo-ip-tree-builder/run.php input/GeoLite2-Country-Blocks-IPv4.csv input/GeoLite2-Country-Locations-en.csv data
60
47
  git status
61
48
 
62
-
63
49
  - name: Get current date
64
50
  id: date
65
51
  run: |
66
52
  echo "::set-output name=date::$(date +'%Y%m%d')"
67
53
  echo "Update database ${{steps.date.outputs.date}}"
68
-
54
+
55
+ - name: Update composer and npm package versions
56
+ run: |
57
+ npm --no-git-tag-version version "v1.1.${{steps.date.outputs.date}}"
69
58
 
70
59
  - name: Commit and tag if changed
71
60
  uses: stefanzweifel/git-auto-commit-action@v4
72
- id: commit
73
61
  with:
74
62
  commit_message: "Update database ${{steps.date.outputs.date}}"
75
- tagging_message: "v1.0.${{steps.date.outputs.date}}"
63
+ tagging_message: "v1.1.${{steps.date.outputs.date}}"
76
64
  branch: main
77
65
 
78
- - name: Publish NPM version
79
- if: steps.commit.outputs.changes_detected == 'true'
80
- uses: JS-DevTools/npm-publish@v1
66
+ - uses: actions/setup-node@v3
81
67
  with:
82
- token: ${{ secrets.NPM_TOKEN }}
83
- tag: 1.0.${{steps.date.outputs.date}}
68
+ node-version: '16.x'
69
+ registry-url: 'https://registry.npmjs.org'
70
+
71
+ - name: "Publish npm releases"
72
+ run: |
73
+ npm publish
74
+ env:
75
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/README.md CHANGED
@@ -1,3 +1,35 @@
1
- ## Source
2
-
3
- This product includes GeoLite2 data created by MaxMind, available from [https://www.maxmind.com](https://www.maxmind.com).
1
+ # Geo IP Database
2
+
3
+ This is an automated repository that downloads and processes GeoLite database from [Maxmind GeoLite database](#source), and processes it to be consumed by [`ayesh/geo-ip`](https://github.com/Ayesh/Geo-IP) composer package.
4
+
5
+
6
+ This repository only contains the JSON files that other packages (mainly [`ayesh/geo-ip`](https://github.com/Ayesh/Geo-IP)) consumes.
7
+
8
+ This repository is automatically updated on every Monday, and if there are new changes, a new minor version will be tagged and published automatically.
9
+
10
+ See [`Ayesh/Geo-IP-Tree-Builder`](https://github.com/Ayesh/Geo-IP-Tree-Builder) for the actual parser.
11
+
12
+ ## Usage
13
+
14
+ [`ayesh/geo-ip`](https://github.com/Ayesh/Geo-IP) package is the main target use case, and that package `require`s this repository. If you use `ayesh/geo-ip` package, no further action is necessary.
15
+
16
+ ### Composer
17
+
18
+ ```bash
19
+ composer require ayesh/geo-ip-database ^1.0.0
20
+ ```
21
+
22
+ ### NPM/Yarn
23
+
24
+ ```bash
25
+ npm i @ayesh/geo-ip-database
26
+ ```
27
+
28
+ ## Updates
29
+
30
+ This repository will be updated and tagged automatically. Make sure to require the `ayesh/geo-ip-database` without pinning a specific version (e.g `^1.0.0`), and running `npm up` or `composer update` should automatically use the newest database version.
31
+
32
+
33
+ ## Source
34
+
35
+ This product includes GeoLite2 data created by MaxMind, available from [https://www.maxmind.com](https://www.maxmind.com).
package/composer.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "ayesh/geo-ip-database",
3
+ "description": "Weekly updated database of IP CIDR to Country codes, indexed by the first 1/4th of the IP address",
4
+ "type": "library",
5
+ "license": "CC-BY-NC-SA-4.0",
6
+ "authors": [
7
+ {
8
+ "name": "Ayesh Karunaratne",
9
+ "email": "ayesh@aye.sh"
10
+ }
11
+ ],
12
+ "require-dev": {
13
+ "ayesh/geo-ip-tree-builder": "^1.1.0"
14
+ }
15
+ }
package/data/1.json CHANGED
@@ -1,58 +1,39 @@
1
1
  {
2
2
  "0": "AU",
3
3
  "256": "CN",
4
- "512": "CN",
5
4
  "1024": "AU",
6
5
  "2048": "CN",
7
6
  "4096": "JP",
8
7
  "8192": "CN",
8
+ "16384": "JP",
9
9
  "32768": "TH",
10
10
  "65536": "CN",
11
- "65792": "AU",
11
+ "65792": "US",
12
+ "65793": "",
13
+ "65794": "US",
14
+ "65796": "AU",
12
15
  "66048": "CN",
13
- "66560": "CN",
14
- "67584": "CN",
15
- "69632": "CN",
16
- "73728": "CN",
17
16
  "81920": "JP",
18
17
  "98304": "TH",
19
18
  "131072": "CN",
20
- "131584": "CN",
21
19
  "131840": "AU",
22
20
  "132096": "CN",
23
- "133120": "CN",
24
21
  "133376": "RU",
25
22
  "133632": "CN",
26
- "134144": "CN",
27
- "135168": "CN",
28
- "139264": "CN",
29
- "147456": "CN",
30
23
  "163840": "TH",
31
24
  "196608": "CN",
32
25
  "262144": "AU",
33
26
  "262400": "CN",
34
- "262656": "CN",
35
- "263168": "CN",
36
- "264192": "CN",
37
27
  "264448": "RU",
38
28
  "264704": "CN",
39
- "265216": "CN",
40
- "266240": "CN",
41
- "270336": "CN",
42
- "278528": "CN",
43
29
  "294912": "TH",
44
30
  "327680": "JP",
45
31
  "393216": "IN",
46
32
  "524288": "CN",
47
33
  "589824": "MY",
48
34
  "655360": "CN",
49
- "657408": "CN",
50
35
  "657920": "AU",
51
36
  "658176": "CN",
52
- "658432": "CN",
53
- "659456": "CN",
54
- "663552": "CN",
55
- "671744": "CN",
56
37
  "688128": "TH",
57
38
  "720896": "KR",
58
39
  "786432": "CN",
@@ -63,13 +44,10 @@
63
44
  "1572864": "CN",
64
45
  "2097152": "MY",
65
46
  "2129920": "SG",
66
- "2146304": "SG",
67
47
  "2146816": "TW",
68
48
  "2147072": "SG",
69
- "2147328": "SG",
70
49
  "2147584": "TW",
71
50
  "2147840": "SG",
72
- "2148352": "SG",
73
51
  "2148864": "TW",
74
52
  "2148992": "SG",
75
53
  "2149120": "TW",
@@ -78,72 +56,23 @@
78
56
  "2149504": "SG",
79
57
  "2149632": "HK",
80
58
  "2149888": "SG",
81
- "2150400": "SG",
82
- "2152448": "SG",
83
59
  "2153472": "KR",
84
60
  "2153728": "SG",
85
- "2153984": "SG",
86
- "2154496": "SG",
87
- "2155008": "SG",
88
- "2155040": "SG",
89
- "2155056": "SG",
90
- "2155064": "SG",
91
61
  "2155065": "JP",
92
62
  "2155066": "SG",
93
- "2155068": "SG",
94
- "2155072": "SG",
95
- "2155136": "SG",
96
- "2155264": "SG",
97
- "2155520": "SG",
98
- "2156544": "SG",
99
- "2158592": "SG",
100
- "2160640": "SG",
101
63
  "2161664": "KH",
102
64
  "2161920": "SG",
103
- "2162176": "SG",
104
65
  "2162688": "JP",
105
66
  "2228224": "CN",
106
67
  "2228225": "TW",
107
- "2228226": "TW",
108
- "2228228": "TW",
109
- "2228232": "TW",
110
- "2228240": "TW",
111
- "2228256": "TW",
112
- "2228288": "TW",
113
- "2228352": "TW",
114
- "2228480": "TW",
115
- "2228736": "TW",
116
- "2229248": "TW",
117
- "2230272": "TW",
118
- "2232320": "TW",
119
- "2236416": "TW",
120
- "2244608": "TW",
121
- "2260992": "TW",
122
- "2293760": "TW",
123
68
  "2359296": "HK",
124
69
  "2424832": "PH",
125
70
  "2490368": "IN",
126
71
  "2621440": "AU",
127
- "2883584": "AU",
128
72
  "2949120": "CN",
129
73
  "3014656": "TH",
130
- "3022848": "TH",
131
- "3026944": "TH",
132
- "3028992": "TH",
133
- "3030016": "TH",
134
74
  "3030017": "CN",
135
75
  "3030018": "TH",
136
- "3030020": "TH",
137
- "3030024": "TH",
138
- "3030032": "TH",
139
- "3030048": "TH",
140
- "3030080": "TH",
141
- "3030144": "TH",
142
- "3030272": "TH",
143
- "3030528": "TH",
144
- "3031040": "TH",
145
- "3047424": "TH",
146
- "3080192": "TH",
147
76
  "3145728": "CN",
148
77
  "3407872": "VN",
149
78
  "3670016": "CN",
@@ -155,47 +84,35 @@
155
84
  "6291456": "KR",
156
85
  "7340032": "JP",
157
86
  "7602176": "CN",
87
+ "7741440": "NL",
88
+ "7741696": "CN",
158
89
  "7864320": "AU",
159
- "8388608": "AU",
160
90
  "10485760": "TW",
161
- "11010048": "TW",
162
- "11272192": "TW",
163
- "11337728": "TW",
164
- "11354112": "TW",
165
- "11358208": "TW",
166
- "11360256": "TW",
167
- "11361280": "TW",
168
- "11361792": "TW",
169
- "11361856": "TW",
170
- "11361872": "TW",
171
- "11361880": "TW",
172
91
  "11361884": "RU",
173
92
  "11361888": "TW",
174
- "11361920": "TW",
175
- "11362048": "TW",
176
- "11362304": "TW",
177
- "11370496": "TW",
178
- "11403264": "TW",
179
93
  "11534336": "KR",
180
94
  "11665408": "AU",
181
- "11698176": "AU",
182
- "11714560": "AU",
183
- "11718656": "HK",
95
+ "11673600": "BR",
96
+ "11677696": "AR",
97
+ "11681792": "AU",
98
+ "11694080": "PS",
99
+ "11702272": "AU",
100
+ "11718656": "PS",
184
101
  "11722752": "ES",
185
102
  "11730944": "AU",
186
- "11747328": "AU",
103
+ "11741184": "PS",
104
+ "11743232": "AU",
105
+ "11749376": "PS",
106
+ "11751424": "AU",
107
+ "11753472": "PS",
187
108
  "11755520": "AU",
188
- "11759616": "AU",
109
+ "11759616": "FR",
189
110
  "11763712": "TH",
190
111
  "11796480": "CN",
191
- "12058624": "CN",
192
112
  "12189696": "IN",
193
113
  "12320768": "CN",
194
- "12582912": "CN",
195
114
  "13107200": "TW",
196
115
  "13172736": "KR",
197
116
  "13238272": "CN",
198
- "13369344": "CN",
199
- "13631488": "KR",
200
- "14680064": "KR"
201
- }
117
+ "13631488": "KR"
118
+ }
package/data/100.json CHANGED
@@ -1,22 +1,10 @@
1
1
  {
2
2
  "0": "US",
3
- "2097152": "US",
4
- "2621440": "US",
5
- "2752512": "US",
6
- "2756608": "US",
7
3
  "2757632": "CA",
8
4
  "2758656": "US",
9
- "2760704": "US",
10
- "2768896": "US",
11
- "2785280": "US",
12
- "2801664": "US",
13
- "2809856": "US",
14
5
  "2813952": "CA",
15
6
  "2818048": "US",
16
7
  "2834432": "RU",
17
8
  "2842624": "CA",
18
- "2850816": "US",
19
- "2883584": "US",
20
- "3145728": "US",
21
- "8388608": "US"
9
+ "2850816": "US"
22
10
  }