No description
Find a file
Nemuel Wainaina 65f849acc1 Initial commit
2025-07-22 19:57:21 +03:00
src Initial commit 2025-07-22 19:57:21 +03:00
.gitignore Initial commit 2025-07-22 19:57:21 +03:00
LICENSE Initial commit 2025-07-22 19:57:21 +03:00
myip.nimble Initial commit 2025-07-22 19:57:21 +03:00
README.md Initial commit 2025-07-22 19:57:21 +03:00

myip

Nim client for the MyIP (https://my-ip.io) API

Installation

Run this command in your project directory:

nimble install myip

Usage

Import the package

import myip

Get IP info (IPv4 and IPv6 supported)

# 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"
  }
}

Get IPv4 info

# getIPv4(): IP
let ipInfo = getIPv4()
echo ipInfo.ip

Sample output: 181.211.201.172

Get IPv6 info

# getIPv6(): IP
let ipInfo = getIPv6()
echo ipInfo.ip

Sample output: 3d0c:fe27:142e:f2fd:8c00:c1f8:c301:4dc0

Contributing

Contributions are welcome! Feel free to create an issue or open a pull request.

License

This project is licensed under the terms of the GNU GPL v3.0 License.