| Crates.io | rlibupnp |
| lib.rs | rlibupnp |
| version | 0.1.0 |
| created_at | 2025-06-25 20:03:32.413191+00 |
| updated_at | 2025-06-25 20:03:32.413191+00 |
| description | Rust UPnP library |
| homepage | |
| repository | https://github.com/sectorrent/rlibupnp |
| max_upload_size | |
| id | 1726358 |
| size | 17,089 |
This is a Rust implementation of UPnP as a library. You can easily add this to your project.
If you want to use the Java version.
Below are some of the commands you can use:
let upnp = UPnP::new(IpAddr::from([192, 168, 0, 129])).expect("Cannot find gateway");
println!("{}", upnp.get_external_ip().unwrap().to_string());
println!("OPEN: {:?}", upnp.open_port(4040, Tcp).unwrap());
println!("MAPPED: {:?}", upnp.is_mapped(4040, Tcp).unwrap());
println!("CLOSE: {:?}", upnp.close_port(4040, Tcp).unwrap());
//FOR UDP
println!("MAPPED: {:?}", upnp.is_mapped(4040, Udp).unwrap());