ceptacle/libcoin — Issue #18: coinNAT library
Author: gronager
Created: 2012-01-28 11:10:39+00:00
State: open

coinNAT contains utilities to mitigate the issues from running a client on a private network with NAT.
coinNAT has two options for NAT traversal and a fallback:
* IGD/UPnP, using miniupnp
* NAT-PMP using natpmp
The code for the libraries have been included for easy building.
The fall back is checkmyip that at least offer to obtain the ip using an external service.
coinNAT is simple to use, from e.g. bitcoind get a handle to the io_service of the Node and use that in the constructor of PortMapper:
PortMapper mapper(node.get_io_service(), port), where port is the listen port (typically 8333).
PortMapper will then first request port mapping using IGD/UPnP. If that failes it will try using NAT-PMP, and finally it will use checkmyip to obtain the.
If not successful, port mapper will try again after 10 minutes, or if successful, query the status, and ensure the lease is still valid.