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>
impl<P: Provider> Gateway<P>
sourcepub async fn get_external_ip(&self) -> Result<IpAddr, GetExternalIpError>
pub async fn get_external_ip(&self) -> Result<IpAddr, GetExternalIpError>
Get the external IP address of the gateway in a tokio compatible way
sourcepub async fn get_any_address(
&self,
protocol: PortMappingProtocol,
local_addr: SocketAddr,
lease_duration: u32,
description: &str,
) -> Result<SocketAddr, AddAnyPortError>
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.
sourcepub async fn add_any_port(
&self,
protocol: PortMappingProtocol,
local_addr: SocketAddr,
lease_duration: u32,
description: &str,
) -> Result<u16, AddAnyPortError>
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.
sourcepub async fn add_port(
&self,
protocol: PortMappingProtocol,
external_port: u16,
local_addr: SocketAddr,
lease_duration: u32,
description: &str,
) -> Result<(), AddPortError>
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.
sourcepub async fn remove_port(
&self,
protocol: PortMappingProtocol,
external_port: u16,
) -> Result<(), RemovePortError>
pub async fn remove_port( &self, protocol: PortMappingProtocol, external_port: u16, ) -> Result<(), RemovePortError>
Remove a port mapping.
sourcepub async fn get_generic_port_mapping_entry(
&self,
index: u32,
) -> Result<PortMappingEntry, GetGenericPortMappingEntryError>
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§
impl<P> Eq for Gateway<P>
Auto Trait Implementations§
impl<P> Freeze for Gateway<P>where
P: Freeze,
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.