#include <iostream>

#include <httplib.h>    
#include <nlohmann/json.hpp>
#include <libassert/assert.hpp>

int main() {
    std::cout << "Retrieving IP address..." << std::endl;

    httplib::Client cli("http://ipinfo.io");
    auto res = cli.Get("/ip");

    ASSERT(res->status == 200, "Failed to get IP");

    nlohmann::json j;
    j["ip"] = res->body;
    j["status"] = res->status;

    std::cout << j.dump(4) << std::endl;

    std::cout << "Done" << std::endl;
    
    return 0;
}
