pub fn add_ports(
configs: impl IntoIterator<Item = UpnpConfig>,
) -> impl Iterator<Item = Result<(), Error>>Expand description
Add port mappings.
This function takes an iterable of UpnpConfigs and opens all configures ports.
Errors are logged, but otherwise ignored. An error during opening a port will not stop the processing of the other ports.
ยงExample
use log::error;
use easy_upnp::{add_ports, PortMappingProtocol, UpnpConfig};
let config = UpnpConfig {
address: None,
port: 80,
protocol: PortMappingProtocol::TCP,
duration: 3600,
comment: "Webserver".to_string(),
};
for result in add_ports([config]) {
if let Err(err) = result {
error!("{}", err);
}
}