my-ip 0.2.0

Get your private and public ip addresses


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

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:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 2737 downloads total

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