'RTCIceCandidate returning mDNS instead of IPv4 address
Code:
var findIP = new Promise(r => { var w: any = window, a = new (w.RTCPeerConnection || w.mozRTCPeerConnection || w.webkitRTCPeerConnection)({ iceServers: [] }), b = () => { }; a.createDataChannel(""); a.createOffer(c => a.setLocalDescription(c, b, b), b); a.onicecandidate = c => { try { c.candidate.candidate.match(/([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/g).forEach(r) } catch (e) { } } })
findIP.then(function (ip) {
console.log(ip)
})
Now this piece of code used to return private IP of the user but now it returns an mDNS .local string.
Use Case: I have an angular app where I need to monitor which client has made what changes and prepare logs accordingly(feature requested by client). Is there any way I can gather private IP without having to ask for camera permission or disabling chrome flag?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
