Nim client for the MyIP (https://my-ip.io) API
Run this command in your project directory:
nimble install myip
import myip
# getIP(): IP
let ipInfo = getIP()
echo ipInfo
Sample output:
{
"success": true,
"ip": "23.88.33.229",
"type": "IPv4",
"country": {
"code": "DE",
"name": "Germany"
},
"region": "Bavaria",
"city": "Gunzenhausen",
"location": {
"lat": 49.1156,
"lon": 10.7511
},
"timeZone": "Europe/Berlin",
"asn": {
"number": 24940,
"name": "Hetzner Online GmbH",
"network": "23.88.0.0/17"
}
}
# getIPv4(): IP
let ipInfo = getIPv4()
echo ipInfo.ip
Sample output: 181.211.201.172
# getIPv6(): IP
let ipInfo = getIPv6()
echo ipInfo.ip
Sample output: 3d0c:fe27:142e:f2fd:8c00:c1f8:c301:4dc0
Contributions are welcome! Feel free to create an issue or open a pull request.
This project is licensed under the terms of the GNU GPL v3.0 License.