Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic public port assignment #7

Open
betamos opened this issue May 5, 2020 · 0 comments
Open

Automatic public port assignment #7

betamos opened this issue May 5, 2020 · 0 comments

Comments

@betamos
Copy link
Contributor

betamos commented May 5, 2020

UPNP has an addAnyPortMapping method where the gateway selects a free high-number port, avoiding collisions with an existing port.

It seems PMP has an equivalent:

   If the client would prefer to have a high-numbered "anonymous"
   external port assigned, then it should set the Requested External
   Port to zero, which indicates to the gateway that it should allocate
   a high-numbered port of its choosing.

Given a blank API it'd be worth considering client.map(port, [opts]) to auto-assign the public port, but this already has defined semantics (sets both private and public ports). If backwards-compatibility is required, perhaps setting publicPort = 'auto' would work? Happy to send a PR if you're interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant