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




Boost Software License - Version 1.0


  1. 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: latitude: 37.385999999999996 longitude: -122.0838 org: AS15169 Google Inc. city: Mountain View region: California country: US postal: 94043 */

  • Declaration

    struct IpinfoData;

    Data gathered in IpinfoData:

    1. struct IpinfoData { string ip; string latitude; string longitude; string org; string city; string region; string country; string postal; }

  • Declaration

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

    Returns the ipinfo info using a callback.


    void delegate(IpinfoData data, Exception err) cb

    The callback to fire when the ipinfo has been downloaded. The callback sends the IpinfoData data and an Exception if there was any problem.