Struct igd::Gateway
[−]
[src]
pub struct Gateway {
pub addr: SocketAddrV4,
pub control_url: String,
}This structure represents a gateway found by the search functions.
Fields
addr | Socket address of the gateway |
control_url | Control url of the device |
Methods
impl Gateway[src]
fn get_external_ip(&self) -> Result<Ipv4Addr, GetExternalIpError>
Get the external IP address of the gateway.
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.
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.
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.
fn remove_port(&self, protocol: PortMappingProtocol, external_port: u16) -> Result<(), RemovePortError>
Remove a port mapping.
Trait Implementations
impl Display for Gateway[src]
Derived Implementations
impl Hash for Gateway[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher1.3.0
Feeds a slice of this type into the state provided.
impl Eq for Gateway[src]
impl PartialEq for Gateway[src]
fn eq(&self, __arg_0: &Gateway) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Gateway) -> bool
This method tests for !=.
impl Debug for Gateway[src]
impl Clone for Gateway[src]
fn clone(&self) -> Gateway
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more