addressesShareIPFamily function
Whether two IP multiaddrs belong to the same address family.
Used when expanding an unspecified listener onto concrete interfaces: an IPv4-bound socket must never be advertised with an IPv6 interface address, or vice versa.
Implementation
bool addressesShareIPFamily(MultiAddr first, MultiAddr second) =>
(first.hasProtocol('ip4') && second.hasProtocol('ip4')) ||
(first.hasProtocol('ip6') && second.hasProtocol('ip6'));