浏览器获取当前ip
function findIP(callback) { var myPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection; // compatibility for firefox and chrome // console.log(myPeerConnection ) var restartConfig = { iceServers: [] }; // var pc = new myPeerConnection({ iceServers: [] }), var pc = new myPeerConnection({ iceServers: [] }), noop = function () {}, localIPs = {}, ipRegex = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/ g, key; function ipIterate(ip) { if (! localIPs[ip]) callback(ip); localIPs[ip] = true ; } pc.setConfiguration(restartConfig);