Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eddiejibson/nexip
A lightweight javascript library to determine for quickly determining user's IPv6 and IPv4 addresses.
https://github.com/eddiejibson/nexip
Last synced: 4 days ago
JSON representation
A lightweight javascript library to determine for quickly determining user's IPv6 and IPv4 addresses.
- Host: GitHub
- URL: https://github.com/eddiejibson/nexip
- Owner: eddiejibson
- License: gpl-3.0
- Created: 2018-04-02T23:53:21.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-04-02T23:52:13.000Z (over 6 years ago)
- Last Synced: 2024-10-12T04:27:12.411Z (about 1 month ago)
- Language: JavaScript
- Homepage: https://ip.nex.li
- Size: 0 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NexIP
A lightweight javascript library to determine for quickly determining user's IPv6 and IPv4 addresses.
## Installing
You can either include the script as hosted on ip.nex.li:
Or [download the NexIP.js](https://ip.nex.li/NexIP.js), put it on your server and then include it.
## Functions
If you are intersted in a specific IP you can just use the `NexIP.getIPv4(callback, forgetOld)` or `NexIP.getIPv6(callback, forgetOld)` functions for IPv4 and IPv6, respectively.
Alternatively, if you're interested in both IPs, then use `NexIP.redetermineIPs(callback, forgetOld)`.
- `callback` is your javascript function that will be called once the IP is determined. In the case of `NexIP.getIPv4` and `NexIP.getIPv6` the argument given to your function is the IPv4 or IPv6, respectively.
- `forgetOld` will tell the library that you don't want to use the already-determined IP, if applicable.## The variables
With the callback of `NexIP.getIPv4` and `NexIP.getIPv6` and `NexIP.ipv4` and `NexIP.ipv6` you will get an IP address. In most cases, this should be a string. However, it could also be `null` or `undefined`:
- `null` means that the IP could not be determined do to an error, most likely because the user doesn't have an IP address of that kind.
- `undefined` mean that the IP was not yet determined. This will only happen if you ask `NexIP.ipv4` and `NexIP.ipv6` directly.