Struct igd::Gateway

source ·
pub struct Gateway {
    pub addr: SocketAddrV4,
    pub root_url: String,
    pub control_url: String,
    pub control_schema_url: String,
    pub control_schema: HashMap<String, Vec<String>>,
}
Expand description

This structure represents a gateway found by the search functions.

Fields§

§addr: SocketAddrV4

Socket address of the gateway

§root_url: String

Root url of the device

§control_url: String

Control url of the device

§control_schema_url: String

Url to get schema data from

§control_schema: HashMap<String, Vec<String>>

Control schema for all actions

Implementations§

source§

impl Gateway

source

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

Get the external IP address of the gateway.

source

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

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.

source

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

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.

source

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

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.

source

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

Remove a port mapping.

source

pub fn get_generic_port_mapping_entry( &self, index: u32 ) -> Result<PortMappingEntry, GetGenericPortMappingEntryError>

Get one port mapping entry

Gets one port mapping entry by its index. Not all existing port mappings might be visible to this client. If the index is out of bound, GetGenericPortMappingEntryError::SpecifiedArrayIndexInvalid will be returned

Trait Implementations§

source§

impl Clone for Gateway

source§

fn clone(&self) -> Gateway

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Gateway

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Gateway

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more