rlibupnp 0.1.1

Rust UPnP library
Documentation
  • Coverage
  • 0%
    0 out of 27 items documented0 out of 18 items with examples
  • Size
  • Source code size: 17.53 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 484.87 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 14s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • sectorrent/rlibupnp
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • DrBrad

rlibupnp

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.

Implementation

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());