[erlang-questions] Simple NAT traversal
Edward Wang
edward.yu.wang@REDACTED
Wed Feb 1 10:50:13 CET 2012
If your NAT device supports UPnP, you can ask for its external address
using UPnP protocol. But there's nothing simple in it. UPnP is a
horrible protocol.
That said, if you do want to try this, you can check out UPnP
implementation in etorrent. I did that about one year ago for opening
port mapping. The related source code are
(https://github.com/edwardw/etorrent/tree/master/apps/etorrent/src):
etorrent_upnp_sup.erl
etorrent_upnp_proto.erl
etorrent_upnp_net.erl
etorrent_upnp_handler.erl
etorrent_upnp_entity.erl
They are quite standalone and complete UPnP implementation. Take a
look at how add_port_mapping is implemented:
https://github.com/jlouis/etorrent/blob/master/apps/etorrent/src/etorrent_upnp_net.erl#L155
It should be easy enough to add your own get_external_address
function, which is defined in following specification:
http://upnp.org/specs/gw/UPnP-gw-WANIPConnection-v1-Service.pdf
Regards,
Edward
On Wed, Feb 1, 2012 at 4:25 PM, eigenfunction <emeka_1978@REDACTED> wrote:
> Hi everybody,
> i have an erlang application running behind a nat. Now i have come to
> a point where i need to know my public ip. I was thinking about
> running a tiny tcp server behind the nat whose sole purpose would be
> to send me my public ip. My question is this: isn't there a more
> simple alternative? Heck, even if i could determine the public ip of
> the NAT device without doing a "backflip" it will be enough for my
> case.
> Any idea?
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list