An easy way is to use an IP Geolocation API like my service: https://astroip.co which supports both IPv4 and IPv6.
Calling:
https://api.astroip.co/2c0f:fd58:9:198::255e/?api_key=1725e47c-1486-4369-aaff-463cc9764026
Returns:
{
"status_code": 200,
"geo": {
"is_metric": true,
"is_eu": false,
"longitude": 24,
"latitude": -29,
"country_geo_id": 953987,
"zip_code": null,
"city": null,
"region_code": null,
"region_name": null,
"continent_code": "AF",
"continent_name": "Africa",
"capital": "Pretoria",
"country_name": "South Africa",
"country_code": "ZA"
},
"asn": {
"route": "2c0f:fd58::/32",
"name": "Vox-Telecom",
"type": "isp",
"domain": "voxtelecom.co.za",
"organization": "Vox-Telecom",
"asn": "AS11845"
},
"currency": {
"native_name": "Suid-Afrikaanse rand",
"code": "ZAR",
"name": "South African Rand",
"symbol": "R"
},
"timezone": {
"is_dst": false,
"gmt_offset": 7200,
"date_time": "2020-11-23T22:59:29+02:00",
"microsoft_name": "South Africa Standard Time",
"iana_name": "Africa/Johannesburg"
},
"security": {
"is_crawler": false,
"is_proxy": false,
"is_tor": false,
"tor_insights": null,
"proxy_insights": null,
"crawler_insights": null
},
"crypto": null,
"user_agent": null,
"error": null,
"ip_type": "ipv6",
"ip": "2c0f:fd58:9:198::255e"
}
You can find more details on https://astroip.co/docs