asebadummynode should allow ephemeral ports (and advertise using Zeroconf)
Asebadummynode takes an optional argument 0–9 for its node type, and hardwires a TCP port in the range 33333–33342. This behavior is expected by many programs.
We should allow dynamic allocation of ephemeral ports as described in RFC 6335 Internet Assigned Numbers Authority (IANA) Procedures for the Management of the Service Name and Transport Protocol Port Number Registry. Since bind
will do this in Posix and Windows if the requested port is 0, it should be enough to use port=0
in the Dashel target.
I propose adding an optional parameter to asebadummynode:
- --port|-p INTEGER|any
to allow asebadummynode to request any port, with a value of 'any' or '0' indicating that a dynamic port number should be chosen from the ephemeral range. Note that this will also allow creating multiple instances of dummynode-i with the same node id on the same host machine.
Since the caller will not know what port was allocated, asebadummynode could print the Dashel target, or at least the port number. Ideally, asebadummynode would advertise itself using Zeroconf as described in issue #543 “Advertise targets using Zeroconf”.