net.list() ignores multiple ports on the same IP address
Multiple invocations of net.listen()
using the same IP address but different port will confuse output of net.list()
. Only single endpoint description listening for a given IP address is returned by net.list
:
Example:
$ KRESD_NO_LISTEN=1 kresd
> net.list()
> net.listen('::1', 5353)
true
> net.list()
[::1] => {
[tcp] => true
[tls] => false
[udp] => true
[port] => 5353
}
> net.listen('::1', 53000)
true
> net.list()
[::1] => {
[tcp] => true
[tls] => false
[udp] => true
[port] => 5353
}
Fixing this obviously requires change to net.list()
output format, which can be done in upcoming 4.0.
The main question is how the new output should look like. Preliminary proposal: { address = 'string', transport = udp/tcp/quic, transport_params = { [transport-dependent parameters - port etc.] }, security = tls/dtls/..., format = plain DNS/DNS-over-HTTP-binary/DNS-over-HTTP-JSON }
net.list()
would then produce numbered list of tuples, each tuple describing single combination.
While this would be technically correct I don't know if it would be too verbose and ugly. Maybe we should introduce net.summary()
which could produce a nicer output out of net.list()
or something like that.