#ipify #networking #org #ip #interface #resolution #client

ipify-client

ipify.org IP解析服务的客户端接口

1个不稳定版本

使用旧的Rust 2015

0.1.0 2018年8月4日

#5 in #ipify

GPL-3.0-or-later

15KB
132

ipify-client

ipify.org IP解析服务的Rust客户端接口。

用法

[dependencies]
ipify-client = "0.1.0"
extern crate futures;
extern crate hyper;
extern crate ipify_client;

use futures::Future;
use hyper::rt;

fn main() {
        let future = ipify_client::get_ip()
            .map(|ip| {
                println!("This machine's IP address: {}", ip);
            })
            .map_err(|e| {
                eprintln!("failed to successfully resolve future: {:?}", e)
            });
    rt::run(future);
}

打印,例如。

This machine's IP address: 1.2.3.4

lib.rs:

对ipify.org的Rusty接口

依赖

~6MB
~116K SLoC