[][src]Struct igd::Gateway

pub struct Gateway {
    pub addr: SocketAddrV4,
    pub control_url: String,
}

This structure represents a gateway found by the search functions.

Fields

addr: SocketAddrV4

Socket address of the gateway

control_url: String

Control url of the device

Methods

impl Gateway[src]

pub fn get_external_ip(&self) -> Result<Ipv4Addr, GetExternalIpError>[src]

Get the external IP address of the gateway.

pub fn get_any_address(
    &self,
    protocol: PortMappingProtocol,
    local_addr: SocketAddrV4,
    lease_duration: u32,
    description: &str
) -> Result<SocketAddrV4, AddAnyPortError>
[src]

Get an external socket address with our external ip and any port. This is a convenience function that calls get_external_ip followed by add_any_port

The local_addr is the address where the traffic is sent to. The lease_duration parameter is in seconds. A value of 0 is infinite.

Returns

The external address that was mapped on success. Otherwise an error.

pub fn add_any_port(
    &self,
    protocol: PortMappingProtocol,
    local_addr: SocketAddrV4,
    lease_duration: u32,
    description: &str
) -> Result<u16, AddAnyPortError>
[src]

Add a port mapping.with any external port.

The local_addr is the address where the traffic is sent to. The lease_duration parameter is in seconds. A value of 0 is infinite.

Returns

The external port that was mapped on success. Otherwise an error.

pub fn add_port(
    &self,
    protocol: PortMappingProtocol,
    external_port: u16,
    local_addr: SocketAddrV4,
    lease_duration: u32,
    description: &str
) -> Result<(), AddPortError>
[src]

Add a port mapping.

The local_addr is the address where the traffic is sent to. The lease_duration parameter is in seconds. A value of 0 is infinite.

pub fn remove_port(
    &self,
    protocol: PortMappingProtocol,
    external_port: u16
) -> Result<(), RemovePortError>
[src]

Remove a port mapping.

Trait Implementations

impl Clone for Gateway[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Eq for Gateway[src]

impl PartialEq<Gateway> for Gateway[src]

impl Display for Gateway[src]

impl Debug for Gateway[src]

impl Hash for Gateway[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

Auto Trait Implementations

impl Send for Gateway

impl Sync for Gateway

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Erased for T