Struct igd_next::Gateway

source ·
pub struct Gateway {
    pub addr: SocketAddr,
    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: SocketAddr

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<IpAddr, GetExternalIpError>

Get the external IP address of the gateway.

source

pub fn get_any_address( &self, protocol: PortMappingProtocol, local_addr: SocketAddr, lease_duration: u32, description: &str ) -> Result<SocketAddr, 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: SocketAddr, 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: SocketAddr, 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 T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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.

§

impl<T> Instrument for T

§

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

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

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 T
where 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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where 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 T
where 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 T
where 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 T
where 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 T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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