datawookie / medusa-proxy

9 stars 2 forks source link

[Feature request] Using IPinfo.io for IP information (IP Geolocation + ASN) #7

Open abdullahdevrel opened 3 weeks ago

abdullahdevrel commented 3 weeks ago

I would like to recommend ipinfo.io for IP data.

Usage example:

curl https://ipinfo.io/8.8.8.8
{
    "ip": "8.8.8.8",
    "hostname": "dns.google",
    "anycast": true,
    "city": "Mountain View",
    "region": "California",
    "country": "US",
    "loc": "37.4056,-122.0775",
    "org": "AS15169 Google LLC",
    "postal": "94043",
    "timezone": "America/Los_Angeles"
}

Documentation: https://ipinfo.io/developers

Free IP databases: https://ipinfo.io/products/free-ip-database


Consider including IPinfo in the project for accurate data and generous free access. Please let me know what you think. Thank you very much.

datawookie commented 3 weeks ago

Feel free to submit a PR with the proposed changes.

abdullahdevrel commented 3 weeks ago

Hi @datawookie,

Thanks. There is a difference between the current API response and our API response. We do not return the "country name." We only return the country code to make our API response lighter and marginally faster while providing the necessary geolocation context.

{
    "ip": "8.8.8.8",
    "hostname": "dns.google",
    "anycast": true,
    "city": "Mountain View",
    "region": "California",
    "country": "US",
    "loc": "37.4056,-122.0775",
    "org": "AS15169 Google LLC",
    "postal": "94043",
    "timezone": "America/Los_Angeles"
}

Based on the API response the output for the [location](https://github.com/datawookie/medusa-proxy/blob/446f4458884b26fb96ab4f3cd8054c33a7d32f59/proxy/tor.py#L101) will be:

' | US             | San Francisco     | +37.33 / -120.50'

Would this be acceptable?

datawookie commented 3 weeks ago

No problem. How about using the country code too. So, for example, "San Francisco, US".

abdullahdevrel commented 3 weeks ago

@datawookie please kindly review the PR.