matter.js
matter.js copied to clipboard
Make server ports non-reusable and NetworkServer config more flexible
Now takes addresses as a list of listening address instead of one each of IPv4, IPv6 and BLE. Adds support for dual-mode (IPv4 + IPv6) sockets.
Adds one dual-mode UDP listener on all addresses if none is configured. Adds one BLE listener if BLE is supported and "ble" option is not set to false.
Throws an error if there are multiple BLE addresses or the HCI address is specified in the listener list (these require lower-level changes I did not make yet).
I want to make similar changes for Mdns at some point but figured I'd see how these go over first.
Includes some additional convenience methods for variable access.
Oh yeah I forgot, this also includes changes to UDP API so that we don't turn REUSE_ADDR sockopt on by default but only when necessary. This prevents users from accidentally starting multiple servers on the same port and is actually why I was in this code in the first place.