use cnet::getjson;
fn main() {
let url = "https://api.ipify.org?format=json";
let url = "https://ipinfo.io";
getjson(url).map(|js| {
js.get("ip")
.and_then(|ip| ip.as_str())
.map(|ip| {
println!("{}", ip);
})
.unwrap_or_else(|| {
println!("{:?}", js);
});
});
}