Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/benoitc/nat_upnp
Erlang library to map your internal port to an external using UNP IGD
https://github.com/benoitc/nat_upnp
Last synced: 3 months ago
JSON representation
Erlang library to map your internal port to an external using UNP IGD
- Host: GitHub
- URL: https://github.com/benoitc/nat_upnp
- Owner: benoitc
- License: other
- Archived: true
- Created: 2013-07-01T15:37:50.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2019-07-03T03:49:11.000Z (over 5 years ago)
- Last Synced: 2024-05-08T18:15:30.192Z (6 months ago)
- Language: Erlang
- Size: 172 KB
- Stars: 43
- Watchers: 5
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-erlang - nat_upnp - Erlang library to map your internal port to an external using UNP IGD. (Networking)
README
** **DEPRECATED** ** Please look at https://github.com/benoitc/erlang-nat to replace it.
# nat_upnp - Make your port public using UNP #
Copyright (c) 2013 Benoît Chesneau.
__Version:__ 0.1.0
# nat_upnp
**nat_upnp** is an Erlang library library that provides you a way to o
map a local port to the external using [UPnP
IGD](http://en.wikipedia.org/wiki/Internet_Gateway_Device_Protocol).The usage of **nat_upnp** is pretty simple and just the minimum of the
UNP to map a local port to the external.## Example of usage
### Discover the router
```
1> {ok, Context} = nat_upnp:discover().
{ok,{nat_upnp,"http://192.168.1.254:5678/control/wan_ip_connection",
"192.168.1.45"}}
```### Add a port mapping
```
2> Protocol = tcp,
2> ExternalPort = 5638,
2> InternalPort = 5638,
2> Description = "test nat upnp",
2> Timeout = 0,
2> ok = nat_upnp:add_port_mapping(Context, Protocol, ExternalPort, InternalPort, Description, Timeout).
ok
```> Note: Timeout = 0 mean, the port will never be released (ie. infinite
> timeout)### Remove a port mapping
```
3> ok = nat_upnp:delete_port_mapping(Context, Protocol, ExternalPort).
ok
```> Note: don't forget to remove the port you registered to the router
> when you exit the application or close the port. For example you could
> monitor the process that maintain the socket and when it's closing,
> unregister the port. Of course there are many other way to achieve
> that purpose.## Contribute
For issues, comments or feedback please [create an
issue](http://github.com/benoitc/nat_upnp/issues).### Notes for developers
If you want to contribute patches or improve the doc, you will need to
build nat_unp using the `rebar_dev.config` file. It can also be built
using the **Makefile**:```
$ make dev ; # compile & get deps
$ make devclean ; # clean all files
```## Modules ##