shinyoshiaki / werift-webrtc

WebRTC Implementation for TypeScript (Node.js), includes ICE/DTLS/SCTP/RTP/SRTP/WEBM/MP4
MIT License
463 stars 29 forks source link

use multicast-dns to resolve local addresses #378

Closed koush closed 5 months ago

koush commented 5 months ago

safari and now chrome will exchange ice candidates with mdns local addresses, ie:

83c0adfa-97f2-49c0-af07-deb9340ee710.local

This is done to prevent privacy leaks. https://datatracker.ietf.org/doc/html/draft-ietf-rtcweb-mdns-ice-candidates-04

My previous change was using dns.lookup to resolve these local addresses. However, that method only works on Mac, which provides transparent mdns lookup via dns-sd. Linux and Windows need to resolve this via a third party library. I'm using multicast-dns in this case.

koush commented 5 months ago

For the sake of implementation consistency, I've switched it to always use MdnsLookup. This will prevent platform specific quirks that may be hard to track down.

Furthermore, while DnsLookup works on Mac, the thread spawn I suspect was causing crashes in my project anyways.

shinyoshiaki commented 5 months ago

thanks