my-ip 0.2.0

Get your private and public ip addresses


To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

my-ip

DUB Build Status Build status

A library used to retrieve private and public ip addresses.

Usage

Private addresses

An array with the private addresses, both ipv4 and ipv6, can be obtained using the privateAddresses function.

Public address

The public address is retrieved from a web service throught the publicAddress function using a blocking socket. It returns the the ip in dot notation or an empty string if a problem has occured. Specific function to get either ipv4 or ipv6 can be used as publicAddress4 and publicAddress6.

import myip;

void main(string[] args) {

	writeln("Your ipv4 is ", publicAddress4);
	
	auto ipv6 = publicAddress6;
	if(ipv6.length) {
		writeln("Your ipv6 is ", publicAddress6);
	} else {
		writeln("You don't have an ipv6");
	}

}
Authors:
  • Kripth
Sub packages:
my-ip:app
Dependencies:
none
Versions:
0.2.0 2018-Feb-14
0.1.0 2018-Feb-02
~master 2018-Mar-21
Show all 3 versions
Download Stats:
  • 8 downloads today

  • 35 downloads this week

  • 67 downloads this month

  • 2640 downloads total

Score:
1.2
Short URL:
my-ip.dub.pm