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:

Variables

httpGet
void delegate(string url, void delegate(int status, string response) cb) httpGet;
Undocumented in source.

Examples

import std.stdio : stdout, stderr;
import ipinfo : getIpinfo, IpinfoData;

getIpinfo(delegate(IpinfoData data, Exception err) {
	if (err) {
		stderr.writefln("%s", err);
	} else {
		stdout.writefln("ip: %s", data.ip);
		stdout.writefln("latitude: %s", data.latitude);
		stdout.writefln("longitude: %s", data.longitude);
		stdout.writefln("org: %s", data.org);
		stdout.writefln("city: %s", data.city);
		stdout.writefln("region: %s", data.region);
		stdout.writefln("country: %s", data.country);
		stdout.writefln("postal: %s", data.postal);
	}
});

/*
ip: 203.205.28.14
latitude: 37.385999999999996
longitude: -122.0838
org: AS15169 Google Inc.
city: Mountain View
region: California
country: US
postal: 94043
*/

Meta

Version

3.0.0

License

Boost Software License - Version 1.0