🦀 NAT
A library providing a pure Rust implementation of a client for both the NAT Port Mapping Protocol (NAT-PMP, RFC 6886) and the Port Control Protocol (PCP, RFC 6887).
This library is intended to feel like high level, idiomatic Rust, while still maintaining a strong focus on performance. It is asyncronous, and uses the tokio runtime to avoid blocking operations and succinctly handle timeouts on UDP sockets.
Usage
// Attempt a port mapping request through PCP first and fallback to NAT-PMP.
let mapping = match try_port_mapping
.await
;
Missing Features
- PCP describes a
Peeroperation which is not yet implemented. - PCP describes an
Announceoperation, which I don't have plans to implement. - PCP defines a number of protocol options which are not implemented. There is currently no plan to implement them.
- https://www.rfc-editor.org/rfc/rfc6886#section-3.2.1 states that NAT-PMP clients should listen for external IP address changes from the gateway. This is not currently implemented, and I am unsure how useful this would be.