zu1k / nali

An offline tool for querying IP geographic information and CDN provider. 一个查询IP地理信息和CDN服务提供商的离线终端工具.
https://github.com/zu1k/nali
MIT License
3.74k stars 340 forks source link

Discussion about json and jsonline implementation #164

Closed M09Ic closed 1 year ago

M09Ic commented 1 year ago

163 #80

The current data structure of result is not uniform, do we need to standardize the format of result in different db first?

For the time being, we can only convert the result in different formats to interface and then json it.

example:

{"type":0,"ip":"1.1.1.1","text":"澳大利亚 APNIC/CloudFlare公共DNS服务器","info":{"Country":"澳大利亚","Area":"APNIC/CloudFlare公共DNS服务器"}}
{"type":0,"ip":"2.2.2.2","text":"法国 Orange","info":{"Country":"法国","Area":"Orange"}}

The output of the original version is kept in text, while the db details are jsonized as is.

If we want to remove this confusion, we need to first agree on the details of different db result.

M09Ic commented 1 year ago

Three-factor output (Country, Region, City):

output example:

{
    "info": {
        "country": "**",
        "region": "**",
        "city": "**"
    }
}

Two-factor output (Country, Area):

output example:

{
    "info": {
        "country": "**",
        "area": "**"
    }
}

It's ok?

M09Ic commented 1 year ago

reference #165

zu1k commented 1 year ago

Thank you!