nat_traversal
miniupnpc and libnatpmp wrapper
Wraps a native library — check OS Compatibility below for platform-specific linking notes.
Summary
| Latest Version | Unknown |
|---|---|
| License | Apache License 2.0 or MIT |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-07-21 05:24 |
Tags
Installation
nimble install nat_traversal
choosenim install nat_traversal
git clone https://github.com/status-im/nim-nat-traversal
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| nat_traversal | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Source
| Repository | https://github.com/status-im/nim-nat-traversal |
|---|---|
| Homepage | https://github.com/status-im/nim-nat-traversal |
| Registry Source | nimble_official |
README
Nim NAT traversal using wrappers for miniupnpc and libnatpmp
Installation
This repository uses submodules for
miniupnp and
libnatpmp, so either clone it all in
one go with git clone --recurse-submodules <REPO_URL> or clone it normally
and then run git submodule update --init --recursive.
Install it using Nimble:
nimble install
Dependencies
Usage
See the examples directory for some generic usage.
A real-world example, complete with periodic port mapping renewal in a separate thread, is available in nim-eth and nimbus.
By default, your code will be linked to bundled static libraries. If you want to dynamically link against your system libraries, pass the "-d:miniupnpcUseSystemLibs" and/or "-d:libnatpmpUseSystemLibs" flags to the Nim compiler.
Let's see both scenarios in action:
nimble buildBundledLibs
# statically linked against the bundled libminiupnpc.a:
nim c -r -f examples/miniupnpc_test.nim
# dynamically linked against the system libminiupnpc.so:
nim c -r -f -d:miniupnpcUseSystemLibs examples/miniupnpc_test.nim
# statically linked against the bundled libnatpmp.a:
nim c -r -f examples/natpmp_test.nim
# dynamically linked against the system libnatpmp.so:
nim c -r -f -d:libnatpmpUseSystemLibs examples/natpmp_test.nim
TODO
miniupnpc:
- add IPv6 pinhole helper procs for the Miniupnp type
License
These wrappers are licensed and distributed under either of
- MIT license: LICENSE-MIT or http://opensource.org/licenses/MIT
or
- Apache License, Version 2.0, (LICENSE-APACHEv2 or http://www.apache.org/licenses/LICENSE-2.0)
at your option. These files may not be copied, modified, or distributed except according to those terms.