Function igd_next::search_gateway

source ·
pub fn search_gateway(options: SearchOptions) -> Result<Gateway, SearchError>
Expand description

Search gateway, using the given SearchOptions.

The default SearchOptions should suffice in most cases. It can be created with Default::default() or SearchOptions::default().

Example

use igd::{search_gateway, SearchOptions, Result};

fn main() -> Result {
    let gateway = search_gateway(Default::default())?;
    let ip = gateway.get_external_ip()?;
    println!("External IP address: {}", ip);
    Ok(())
}