-
Notifications
You must be signed in to change notification settings - Fork 35
Description
I have a webserver on a port 8000 and need to expose it with natpmpc on WAN on any random port. So then I'll simply generate a link to it and share.
But currently I have to specify explicitly the external port:
natpmpc -a 8000 8000 tcp
The problem here is that I don't know if this external 8000 port is not already taken or allowed by the miniupnpd. So that's why I can't rely on this.
Basically the local port 9000 may be also busy and it would be also useful if the natpmpc can also take some random and free port (maybe ephemeral).
Maybe it can be something like:
natpmpc -a rand rand tcp
Is it possible to implement something like this? Or the PCP spec requires to specify the requested port?
Ideally the natpmpc should print the port numbers to stdout in form
loc_port ext_ip ext_port
Then it would be easy to parse with a script.
Any other logging messages of the natpmpc may be printed to stderr so that a script needs to parse only clear stdout.