ipinfo

Get http://ipinfo.io with the D programming language.

Home page: https://github.com/workhorsy/d-ipinfo

Members

Functions

getIpinfo
void getIpinfo(void delegate(IpinfoData data, Exception err) cb)

Returns the ipinfo info using a callback.

Structs

IpinfoData
struct IpinfoData

Data gathered in IpinfoData:

Examples

1 import std.stdio : stdout, stderr;
2 import ipinfo : getIpinfo, IpinfoData;
3 
4 getIpinfo(delegate(IpinfoData data, Exception err) {
5 	if (err) {
6 		stderr.writefln("%s", err);
7 	} else {
8 		stdout.writefln("ip: %s", data.ip);
9 		stdout.writefln("latitude: %s", data.latitude);
10 		stdout.writefln("longitude: %s", data.longitude);
11 		stdout.writefln("org: %s", data.org);
12 		stdout.writefln("city: %s", data.city);
13 		stdout.writefln("region: %s", data.region);
14 		stdout.writefln("country: %s", data.country);
15 		stdout.writefln("postal: %s", data.postal);
16 	}
17 });
18 
19 /*
20 ip: 203.205.28.14
21 latitude: 37.385999999999996
22 longitude: -122.0838
23 org: AS15169 Google Inc.
24 city: Mountain View
25 region: California
26 country: US
27 postal: 94043
28 */

Meta

Version

1.1.0

License

Boost Software License - Version 1.0