å¯ä»¥ç´æ¥ä»æ¬å°è¯»åIPãåipconfig /allçå°çIPä¸æ ·ã
å¦æçµèç´æ¥æå·ä¸ç½ï¼åè·åå°çå°±æ¯å
¬ç½IPãå¦ææ¯å®¶åºãå¦æ ¡ãå
¬å¸çå
ç½ï¼è·åå°çå°±æ¯å
ç½IPãå¦æç³»ç»éæèæç½å¡ï¼èæç½å¡IPä¹å å
¥å表ã
æµè¯ä»£ç ï¼ï¼å¯¹ChromeåFirefoxææï¼
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>è·åå
ç½IP</title>
</head>
<body>
æ¨çå
ç½IPï¼
<span id="list"></span>
<script>
// NOTE: window.RTCPeerConnection is "not a constructor" in FF22/23
var RTCPeerConnection = /*window.RTCPeerConnection ||*/ window.webkitRTCPeerConnection || window.mozRTCPeerConnection;
if (RTCPeerConnection) (function () {
var rtc = new RTCPeerConnection({iceServers:[]});
if (window.mozRTCPeerConnection) { // FF needs a channel/stream to proceed
rtc.createDataChannel('', {reliable:false});
};
rtc.onicecandidate = function (evt) {
if (evt.candidate) grepSDP(evt.candidate.candidate);
};
rtc.createOffer(function (offerDesc) {
grepSDP(offerDesc.sdp);
rtc.setLocalDescription(offerDesc);
}, function (e) { console.warn("offer failed", e); });
var addrs = Object.create(null);
addrs["0.0.0.0"] = false;
function updateDisplay(newAddr) {
if (newAddr in addrs) return;
else addrs[newAddr] = true;
var displayAddrs = Object.keys(addrs).filter(function (k) { return addrs[k]; });
document.getElementById('list').innerHTML = displayAddrs.join(" or perhaps ") || "n/a";
}
function grepSDP(sdp) {
var hosts = [];
sdp.split('\r\n').forEach(function (line) { // c.f.
http://tools.ietf.org/html/rfc4566#page-39 if (~line.indexOf("a=candidate")) { //
http://tools.ietf.org/html/rfc4566#section-5.13 var parts = line.split(' '), //
http://tools.ietf.org/html/rfc5245#section-15.1 addr = parts[4],
type = parts[7];
if (type === 'host') updateDisplay(addr);
} else if (~line.indexOf("c=")) { //
http://tools.ietf.org/html/rfc4566#section-5.7 var parts = line.split(' '),
addr = parts[2];
updateDisplay(addr);
}
});
}
})(); else {
document.getElementById('list').innerHTML = "<code>ifconfig | grep inet | grep -v inet6 | cut -d\" \" -f2 | tail -n1</code>";
document.getElementById('list').nextSibling.textContent = "In Chrome and Firefox your IP should display automatically, by the power of WebRTCskull.";
}
</script>
</body>
</html>
建ç½ç«çæåï¼å¯ä»¥ç¨è¿ä¸ªå¤æ访客æ¯å
ç½ç¨æ·è¿æ¯å
¬ç½ã并ä¸è·å访客å
ç½IPã
ä¸ç®¡ä½ ç¨äºå¤å°å±å¿å代ç/VPNï¼è¿æ®µä»£ç é½è½ç´æ¥æåæ¬å°IPãç¶åä¸ä¸ªå¼æ¥è¯·æ±ï¼å°±å¯ä»¥è¢«æå¡ç«¯æåãæµè§å¨æ ä»»ä½å®å
¨æ示ã