Skip to content

Commit

Permalink
feature #22: changed dataset format to official
Browse files Browse the repository at this point in the history
  • Loading branch information
iglov committed Apr 28, 2024
1 parent 5e22a16 commit b1c06e2
Show file tree
Hide file tree
Showing 5 changed files with 506 additions and 95 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ Make your own GeoIP database! The simple utility for editing MMDB databases.

# How to use
```text
Usage of ./mmdb-editor:
Usage of ./bin/mmdb-editor-linux-amd64:
-d string
Dataset file path. (default "./dataset.json")
-i string
Input GeoLite2-City.mmdb file path. (default "./GeoLite2-City.mmdb")
-m string
Merge strategy. It may be: toplevel, recurse or replace. (default "replce")
-o string
Output modified mmdb file path. (default "./GeoLite2-City-mod.mmdb")
-v Print current version and exit.
Expand Down
233 changes: 211 additions & 22 deletions dataset.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,213 @@
{
"data": [
{
"ips": ["94.198.54.0/23"],
"country": {
"geoname_id": 2017370,
"iso_code": "RU",
"names": {
"en": "Russia"
}
[
{
"networks": ["214.78.120.0/22"],
"data": {
"city" : {
"geoname_id" : 5391811,
"names" : {
"de" : "San Diego",
"en" : "San Diego",
"es" : "San Diego",
"fr" : "San Diego",
"ja" : "サンディエゴ",
"pt-BR" : "San Diego",
"ru" : "Сан-Диего"
}
},
"continent" : {
"code" : "NA",
"geoname_id" : 6255149,
"names" : {
"de" : "Nordamerika",
"en" : "North America",
"es" : "Norteamérica",
"fr" : "Amérique du Nord",
"ja" : "北アメリカ",
"pt-BR" : "América do Norte",
"ru" : "Северная Америка",
"zh-CN" : "北美洲"
}
},
"country" : {
"geoname_id" : 6252001,
"iso_code" : "US",
"names" : {
"de" : "Vereinigte Staaten",
"en" : "United States",
"es" : "Estados Unidos",
"fr" : "États Unis",
"ja" : "アメリカ",
"pt-BR" : "EUA",
"ru" : "США",
"zh-CN" : "美国"
}
},
"location" : {
"accuracy_radius" : 100,
"latitude" : 32.7405,
"longitude" : -117.0935,
"metro_code" : 825,
"time_zone" : "America/Los_Angeles"
},
"postal" : {
"code" : "92105"
},
"registered_country" : {
"geoname_id" : 6252001,
"iso_code" : "US",
"names" : {
"de" : "Vereinigte Staaten",
"en" : "United States",
"es" : "Estados Unidos",
"fr" : "États Unis",
"ja" : "アメリカ",
"pt-BR" : "EUA",
"ru" : "США",
"zh-CN" : "美国"
}
},
"subdivisions" : [
{
"geoname_id" : 5332921,
"iso_code" : "CA",
"names" : {
"de" : "Kalifornien",
"en" : "California",
"es" : "California",
"fr" : "Californie",
"ja" : "カリフォルニア州",
"pt-BR" : "Califórnia",
"ru" : "Калифорния",
"zh-CN" : "加州"
}
}
]
}
},
{
"ips": ["10.200.0.0/24","192.168.33.13/30","127.0.0.1/32"],
"country": {
"geoname_id": 6255148,
"iso_code": "NA",
"names": {
"en": "Iglov's property"
}
},
{
"networks": ["81.2.69.160/18"],
"data": {
"city" : {
"geoname_id" : 2643743,
"names" : {
"de" : "London",
"en" : "London",
"es" : "Londres",
"fr" : "Londres",
"ja" : "ロンドン",
"pt-BR" : "Londres",
"ru" : "Лондон"
}
},
"org": "My test company",
"continent" : {
"code" : "EU",
"geoname_id" : 6255148,
"names" : {
"de" : "Europa",
"en" : "Europe",
"es" : "Europa",
"fr" : "Europe",
"ja" : "ヨーロッパ",
"pt-BR" : "Europa",
"ru" : "Европа",
"zh-CN" : "欧洲"
}
},
"country" : {
"geoname_id" : 2635167,
"iso_code" : "GB",
"names" : {
"de" : "Vereinigtes Königreich",
"en" : "United Kingdom",
"es" : "Reino Unido",
"fr" : "Royaume-Uni",
"ja" : "イギリス",
"pt-BR" : "Reino Unido",
"ru" : "Великобритания",
"zh-CN" : "英国"
}
},
"location" : {
"accuracy_radius" : 100,
"latitude" : 51.5142,
"longitude" : -0.0931,
"time_zone" : "Europe/London"
},
"registered_country" : {
"geoname_id" : 6252001,
"iso_code" : "US",
"names" : {
"de" : "USA",
"en" : "United States",
"es" : "Estados Unidos",
"fr" : "États-Unis",
"ja" : "アメリカ合衆国",
"pt-BR" : "Estados Unidos",
"ru" : "США",
"zh-CN" : "美国"
}
},
"subdivisions" : [
{
"geoname_id" : 6269131,
"iso_code" : "ENG",
"names" : {
"en" : "England",
"es" : "Inglaterra",
"fr" : "Angleterre",
"pt-BR" : "Inglaterra"
}
}
]
}
}
]
}
},
{
"networks": ["10.0.0.0/8"],
"data": {
"country" : {
"geoname_id" : 6255148,
"iso_code" : "NA",
"names" : {
"en" : "My private property"
}
}
}
},
{
"networks": ["8.8.8.8/32"],
"data": {
"country" : {
"geoname_id" : 6255148,
"iso_code" : "NA",
"names" : {
"en" : "Now it's owned by ME!"
}
}
}
},
{
"networks": ["8.8.8.8/32","10.200.0.0/24","192.168.33.13/30","127.0.0.1/32"],
"data": {
"country" : {
"geoname_id" : 6255148,
"iso_code" : "NA",
"names" : {
"en" : "Iglov's property"
}
}
}
},
{
"networks": ["94.198.54.0/23"],
"data": {
"country" : {
"geoname_id" : 2017370,
"iso_code" : "RU",
"names" : {
"en" : "Russia"
}
}
}
}
]
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ require (
github.com/maxmind/mmdbwriter v1.0.0
github.com/oschwald/maxminddb-golang v1.12.0
github.com/stretchr/testify v1.9.0
go4.org/netipx v0.0.0-20220812043211-3cc044ffd68d
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go4.org/netipx v0.0.0-20220812043211-3cc044ffd68d // indirect
golang.org/x/sys v0.10.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit b1c06e2

Please sign in to comment.