Skip to content

Releases: gibme-npm/multicast

v22.0.1

24 May 02:36
v22.0.1
39c3223

Choose a tag to compare

What's Changed

Breaking changes

  • setTTL removedMulticastSocket.setTTL(ttl) is gone. The library hardcodes IP_MULTICAST_TTL = 255 at bind so the RFC 6762 §11 outbound invariant cannot be silently broken at runtime.

RFC 6762 §11

  • Multicast-destination exemption now honored — Packets received on the shared multicast socket are accepted regardless of source IP, per RFC 6762 §11's carve-out for multicast-destination packets. This fixes cross-subnet-overlay multicast traffic that was previously being dropped. Packets received on per-interface unicast sockets still receive the source-subnet check.
  • README §RFC 6762 §11 rewritten — Crisp SHOULD/MUST mapping, multicast-destination exemption documented, explicit note that the IP_RECVTTL gap in Node's dgram is upstream and not worked around from userspace.

Input validation

  • multicastGroup validated upfront — A non-multicast address now throws multicastGroup X is not a multicast address before any socket allocation, instead of surfacing as a late addMembership EADDRNOTAVAIL. New is_multicast helper is exported from @gibme/multicast/helpers.
  • compare_IP_addresses throws on mixed-family inputs — Previously returned a meaningless ordering when comparing IPv4 to IPv6.

IPv6 zone-id handling

  • fromSelf is now zone-id-tolerant — Node 22's dgram delivers IPv6 link-local rinfo.address with a %iface suffix; the prior exact-string match missed it. dispatch_message now strips the suffix before comparing against bound addresses.
  • srcAddress and host normalized — The same zone-id strip is applied at the three sites that match against bound addresses (create() host check, send() unicast-path, send() multicast-path).

Helpers

  • get_addresses dedup fixed — Was [...new Set(addresses)] which deduped by object reference (a no-op for freshly-constructed instances); now a Map keyed by .address string.
  • get_addresses requires addr.cidr — Throws if os.networkInterfaces() returns an entry without it. Dead-code netmask_to_prefix fallback (IPv4-only dotted-decimal parser) removed.
  • is_on_local_link IPv6 link-local comment — Rewritten to acknowledge both RFC 4291 §2.4 (FE80::/10 reserved prefix) and §2.5.6 (link-local format requires middle 54 bits zero), and explain why the wider /10 check is used for inbound filtering.

Documentation

  • JSDoc on send() and Send.Options.useMulticastSocket — Concurrency note: combining useMulticastSocket: true with srcAddress mutates per-socket state on the shared multicast socket via setMulticastInterface. Concurrent calls race; serialize them in the caller, or use the default per-interface unicast path (race-free).
  • JSDoc on setMulticastLoopback — Explains that it only mutates IP_MULTICAST_LOOP on the shared multicast socket and that the authoritative user-visible loopback gate is the check inside dispatch_message.

Tests

101/101 pass. Added 8 regression tests under a new input validation and dispatch hardening block covering all of the above.

Full Changelog: v22.0.0...v22.0.1

v22.0.0

03 Apr 17:13
6d84d98

Choose a tag to compare

What's Changed

  • Node >=22 — Dropped Node 20 support, CI matrix now tests Node 22 and 24
  • node:test migration — Replaced mocha/ts-node with node:test/tsx
  • OIDC publishing — CI now uses npm trusted publishing instead of classic NPM_TOKEN
  • GitHub Actions v4 — Bumped all workflow actions to latest
  • TypeScript config cleanup — Removed deprecated downlevelIteration, dom/scripthost libs; added rootDir
  • Fixed test race condition — Multi-interface multicast loopback could poison the multiple-messages test with leftover packets
  • Improved README — Added badges, architecture overview, helper exports documentation, IPv6 and error handling examples

v20.02

13 Dec 18:50
986998d

Choose a tag to compare

Multisocket Socket Library

An abstract multicast socket library designed to handle some of the platform specific implementation details that
make it difficult to write a cross platform multicast socket library.

Documentation

https://gibme-npm.github.io/multicast

Features

  • IPv4 and IPv6 Support
  • Windows, Linux, and Mac OS X Support
  • Cross Platform
  • Asynchronous
  • Non-Blocking
  • Supports Multicast and Unicast Messages
  • Supports Joining and Leaving Multicast Groups
  • Proper handling of listening on all interfaces
    • Creates a singular multicast socket for listening (or sending)
    • Creates a separate unicast socket for each interface for receiving unicast replies and/or sending messages (to ensure it goes out on all interfaces when bound to all)
  • Ability to listen on one interface (by IP or name)
  • Supports dynamic TTL
  • Loopback support

Sample Code

import { MulticastSocket } from '@gibme/multicast';

(async () => {
    const socket = await MulticastSocket.create({
        port: 5959,
        multicastGroup: '224.0.0.251',
        loopback: true
    });
    
    socket.on('message', (message, remote, fromSelf) => {
        console.log({message, remote, fromSelf});
    })
    
    socket.send('Hello World');
});

v20.0.1

26 Aug 11:57
72acd58

Choose a tag to compare

Multisocket Socket Library

An abstract multicast socket library designed to handle some of the platform specific implementation details that
make it difficult to write a cross platform multicast socket library.

Documentation

https://gibme-npm.github.io/multicast

Features

  • IPv4 and IPv6 Support
  • Windows, Linux, and Mac OS X Support
  • Cross Platform
  • Asynchronous
  • Non-Blocking
  • Supports Multicast and Unicast Messages
  • Supports Joining and Leaving Multicast Groups
  • Proper handling of listening on all interfaces
    • Creates a singular multicast socket for listening (or sending)
    • Creates a separate unicast socket for each interface for receiving unicast replies and/or sending messages (to ensure it goes out on all interfaces when bound to all)
  • Ability to listen on one interface (by IP or name)
  • Supports dynamic TTL
  • Loopback support

Sample Code

import { MulticastSocket } from '@gibme/multicast';

(async () => {
    const socket = await MulticastSocket.create({
        port: 5959,
        multicastGroup: '224.0.0.251',
        loopback: true
    });
    
    socket.on('message', (message, remote, fromSelf) => {
        console.log({message, remote, fromSelf});
    })
    
    socket.send('Hello World');
});

v20.0.0

24 Aug 21:14
c33b64b

Choose a tag to compare

Updated dependencies

v2.0.0: Massive overhaul of library

15 Jun 16:01
ae82c11

Choose a tag to compare

- We now open multiple sockets instead of a singular socket due to flakiness across platforms:
  - Actual Multicast socket opens to receive actual multicast messages. Can also be used for sending with some quirks in behavior as documented in send() comments
  - Individual sockets for each of the interfaces found and/or specified. These are used for listening for unicast replies which are used by multiple multicast protocols.
- Added proper types for emitted events
- Re-worked the `send()` logic to account for the changes in sockets from above
- Renamed a number of properties

v1.0.0: - updated dependencies

11 May 18:21
dd771a3

Choose a tag to compare

- merged types into namespace

v0.0.1

29 Dec 15:08
3290b12

Choose a tag to compare

initial commit