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?
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.