pub struct Gateway { /* private fields */ }
Expand description
This structure represents a gateway found by the search functions.
Implementations
sourceimpl Gateway
impl Gateway
sourcepub fn new(addr: SocketAddrV4, control_url: String, handle: Handle) -> Gateway
pub fn new(addr: SocketAddrV4, control_url: String, handle: Handle) -> Gateway
Create a new Gateway for a given Handle to a control loop
sourcepub fn get_external_ip(
&self
) -> Box<dyn Future<Item = Ipv4Addr, Error = GetExternalIpError>>
pub fn get_external_ip(
&self
) -> Box<dyn Future<Item = Ipv4Addr, Error = GetExternalIpError>>
Get the external IP address of the gateway in a tokio compatible way
sourcepub fn get_any_address(
&self,
protocol: PortMappingProtocol,
local_addr: SocketAddrV4,
lease_duration: u32,
description: &str
) -> Box<dyn Future<Item = SocketAddrV4, Error = AddAnyPortError>>
pub fn get_any_address(
&self,
protocol: PortMappingProtocol,
local_addr: SocketAddrV4,
lease_duration: u32,
description: &str
) -> Box<dyn Future<Item = SocketAddrV4, Error = 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 fn add_any_port(
&self,
protocol: PortMappingProtocol,
local_addr: SocketAddrV4,
lease_duration: u32,
description: &str
) -> Box<dyn Future<Item = u16, Error = AddAnyPortError>>
pub fn add_any_port(
&self,
protocol: PortMappingProtocol,
local_addr: SocketAddrV4,
lease_duration: u32,
description: &str
) -> Box<dyn Future<Item = u16, Error = 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 fn add_port(
&self,
protocol: PortMappingProtocol,
external_port: u16,
local_addr: SocketAddrV4,
lease_duration: u32,
description: &str
) -> Box<dyn Future<Item = (), Error = AddPortError>>
pub fn add_port(
&self,
protocol: PortMappingProtocol,
external_port: u16,
local_addr: SocketAddrV4,
lease_duration: u32,
description: &str
) -> Box<dyn Future<Item = (), Error = 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 fn remove_port(
&self,
protocol: PortMappingProtocol,
external_port: u16
) -> Box<dyn Future<Item = (), Error = RemovePortError>>
pub fn remove_port(
&self,
protocol: PortMappingProtocol,
external_port: u16
) -> Box<dyn Future<Item = (), Error = RemovePortError>>
Remove a port mapping.
Trait Implementations
impl Eq for Gateway
Auto Trait Implementations
impl !RefUnwindSafe for Gateway
impl !Send for Gateway
impl !Sync for Gateway
impl Unpin for Gateway
impl !UnwindSafe for Gateway
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more