Struct gip::ProviderJson
[−]
[src]
pub struct ProviderJson { pub info: ProviderInfo, pub timeout: usize, pub proxy: Option<(String, u16)>, }
Provider for checking global address by JSON format.
Examples
use gip::{ProviderFormat, ProviderInfo}; let mut p = ProviderInfo::new() .format(ProviderFormat::Json) .url("http://httpbin.org/ip") .key(&vec!["origin".to_string()]) .create(); let addr = p.get_addr().unwrap(); println!( "{:?}", addr.v4addr );
Fields
info: ProviderInfo
Provider info
timeout: usize
Timeout
proxy: Option<(String, u16)>
Proxy
Methods
impl ProviderJson
[src]
Trait Implementations
impl Provider for ProviderJson
[src]
fn get_addr(&mut self) -> Result<GlobalAddress>
[src]
Get global IP address
fn get_name(&self) -> String
[src]
Get provider name
fn get_type(&self) -> ProviderType
[src]
Get provider type
fn set_timeout(&mut self, timeout: usize)
[src]
Set timeout by milliseconds
fn set_proxy(&mut self, host: &str, port: u16)
[src]
Set proxy