Skip to content

Automatic public port assignment #7

@betamos

Description

@betamos

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions