1

I've spent some time looking at different answers, and the best I've found was this response from a different SO question.

The issue is that this returns an mDNS string, like so:

abcd1234-1e1e-1e1e-1e1e-abcd1a2bc3de.local

I have a legitimate use case for this feature, and I've tried finding answers or libraries that are capable of decoding this string, such as webrtc-ips, but this package returns an empty array for me.

Has anyone been able to figure out a way to do this without a third-party, like api.ipify or similar services?

Mike K
  • 7,621
  • 14
  • 60
  • 120
  • 1
    Do you need to do the decoding in the browser? You can get the IPs outside of it easily `dns-sd -q abcd1234-1e1e-1e1e-1e1e-abcd1a2bc3de.local`. But inside the browser it is by design. I wouldn't build anything that uses a workaround, will probably break in the future! – Sean DuBois Jan 19 '22 at 16:37

1 Answers1

2

The design purpose of these mdns strings is that you can not decode them outside the local network.

If you have a legitimate use-case you can explain it in https://github.com/w3c/webrtc-extensions/issues/87 which discusses asking for permission to expose IP addresses without the current workaround to ask for camera permissions.

Philipp Hancke
  • 15,855
  • 2
  • 23
  • 31