Struct igd_next::aio::Gateway

source ·
pub struct Gateway<P> {
    pub addr: SocketAddr,
    pub root_url: String,
    pub control_url: String,
    pub control_schema_url: String,
    pub control_schema: HashMap<String, Vec<String>>,
    pub provider: P,
}
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

§provider: P

Executor provider

Implementations§

source§

impl<P: Provider> Gateway<P>

source

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

Get the external IP address of the gateway in a tokio compatible way

source

pub async 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 async 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 async 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 async fn remove_port( &self, protocol: PortMappingProtocol, external_port: u16 ) -> Result<(), RemovePortError>

Remove a port mapping.

source

pub async 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<P: Clone> Clone for Gateway<P>

source§

fn clone(&self) -> Gateway<P>

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<P: Debug> Debug for Gateway<P>

source§

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

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

impl<P> Display for Gateway<P>

source§

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

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

impl<P> Hash for Gateway<P>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

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

Feeds a slice of this type into the given Hasher. Read more
source§

impl<P> PartialEq for Gateway<P>

source§

fn eq(&self, other: &Gateway<P>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<P> Eq for Gateway<P>

Auto Trait Implementations§

§

impl<P> RefUnwindSafe for Gateway<P>
where P: RefUnwindSafe,

§

impl<P> Send for Gateway<P>
where P: Send,

§

impl<P> Sync for Gateway<P>
where P: Sync,

§

impl<P> Unpin for Gateway<P>
where P: Unpin,

§

impl<P> UnwindSafe for Gateway<P>
where P: UnwindSafe,

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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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