feat(my-ip): 代理/VPN检测(proxycheck.io出口归属判定+WebRTC泄漏实测+本机内网IP)
This commit is contained in:
1 parent
39ec9347e2
commit
b4c4f5de8a
5 files changed
+240
-3
No files matched your search
@@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. See [standa
|
||||
## Version 2026.11.01-it-tools-pro
|
||||
|
||||
### 📦 本次更新(2026-11-01)
|
||||
- **代理 / VPN 检测**(免费不授权):本机IP查询页新增检测区——出口 IP 归属判定(proxycheck.io 数据库,区分家庭宽带/VPN/代理/数据中心/企业网络,IPv4+IPv6 分别判定)+ WebRTC STUN 泄漏实测(浏览器实测公网候选地址,若与主 IP 不一致则提示可能的真实出口,另显示本机内网 IP);浏览器无法直读系统代理开关,判定仅供参考,可一键重新检测
|
||||
- **本机IP查询**(`/my-ip`,免费不授权):打开即显示**用户自己设备**的公网 IPv4 / IPv6 地址与中文归属地(多源容错、一键复制、不显示任何服务器信息);自动测量到 9 个热门地点(本站/清华TUNA/阿里云/腾讯云/华为云/中科大/香港Fedora/日本JAIST/Cloudflare)的延迟
|
||||
- **IPv6 直连通道**:新增 `itv6.88531.cn`(4443 端口,双栈 nginx + DDNS);支持 IPv6 的用户页面横幅一键切换直连,访问速度更快;不支持的用户给出五步开启教程
|
||||
- **网速测试**:测量**你到本站服务器**的真实吞吐(下载/上传/到站延迟),走当前访问线路,浏览器真实收发计时(relay 新增 `/relay/speed` 端点),约 13MB 流量
|
||||
|
||||
+1
-1
@@ -385,7 +385,7 @@ tools:
|
||||
|
||||
my-ip:
|
||||
title: My IP address
|
||||
description: Check your device's public IPv4/IPv6 address and location (with an IPv6 setup guide when unsupported). This site supports IPv6 direct connection. Measure latency to popular places and test your download/upload speed to this server.
|
||||
description: Check your device's public IPv4/IPv6 address and location (with an IPv6 setup guide when unsupported). Detects proxy/VPN via egress IP database and WebRTC leak test. This site supports IPv6 direct connection. Measure latency to popular places and test your download/upload speed to this server with history.
|
||||
|
||||
hash-text:
|
||||
title: Hash text
|
||||
|
||||
+1
-1
@@ -381,7 +381,7 @@ tools:
|
||||
|
||||
my-ip:
|
||||
title: 本机IP查询
|
||||
description: 查询你设备的公网IPv4/IPv6地址与所属地(IPv6不支持时提供开启教程),本站已支持IPv6直连,测连接热门地点延迟,一键测试你到本站服务器的下载/上传网速。
|
||||
description: 查询你设备的公网IPv4/IPv6地址与所属地(IPv6不支持时提供开启教程),代理/VPN检测(出口IP归属判定+WebRTC泄漏实测),本站已支持IPv6直连,测连接热门地点延迟,一键测试你到本站服务器的下载/上传网速并自动记录历史。
|
||||
|
||||
hash-text:
|
||||
title: Hash 文本
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ const groups: { title: string; items: Item[] }[] = [
|
||||
{
|
||||
title: '原创工具',
|
||||
items: [
|
||||
{ name: '本机IP查询', icon: '网', desc: '仅显示你设备的公网IPv4/IPv6地址与所属地(多源容错+中文归属地+一键复制),IPv6不支持时明示并给出开启教程,本站已支持IPv6直连(速度更快),网速测试为你的设备↔本站服务器真实收发计时,进入页面自动测9个热门地点延迟', tag: '全新' },
|
||||
{ name: '本机IP查询', icon: '网', desc: '仅显示你设备的公网IPv4/IPv6地址与所属地(多源容错+中文归属地+一键复制),代理/VPN检测(出口IP归属判定+WebRTC泄漏实测+内网IP),IPv6不支持时明示并给出开启教程,本站已支持IPv6直连(速度更快),网速测试为你的设备↔本站服务器真实收发计时并自动记录历史,进入页面自动测9个热门地点延迟', tag: '全新' },
|
||||
{ name: 'Base64图片互转', icon: 'B', desc: 'Base64转图片与图片转Base64合一页双 Tab:三种输入形态(裸串/data:URI/CSS url())自动识别、图片类型魔数嗅探、输出三档格式实时切换、互转按钮带结果闭环跳转,纯浏览器本地不上传', tag: '全新' },
|
||||
{ name: '批量条码生成', icon: '条', desc: 'EAN/UPC/Code128/Code39/DataMatrix 等 12 种码制,批量生成、打包下载,尺寸颜色字号可调', tag: '全新' },
|
||||
{ name: '二维码条码识别与生成', icon: '扫', desc: '识别:上传/拖拽/粘贴一键解码(多码混合批量输出,本地 WASM 不上传);生成:自定义前景/背景颜色、中间插入本地 Logo 图片,生成后自动自扫验证可下载 PNG', tag: '全新' },
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
// 本机IP查询:用户端公网 IPv4/IPv6 + 归属地 + 本站IPv6直连 + 热门地点延迟 + 网速测试(浏览器 <-> 本站服务器真实收发)
|
||||
type Geo = { country?: string; region?: string; city?: string; isp?: string; as?: string; lan?: boolean } | null;
|
||||
// 代理/VPN 出口判定(relay /ip-check 返回)
|
||||
type ChkInfo = { ip?: string; lan?: boolean; proxy?: boolean | null; type?: string; provider?: string; hostname?: string; asn?: string } | null;
|
||||
|
||||
// ---------- IP 查询(仅用户端视角,不显示服务器地址) ----------
|
||||
const ipLoading = ref(true);
|
||||
@@ -97,6 +99,110 @@ async function loadIps() {
|
||||
v4Geo.value = g4;
|
||||
v6Geo.value = g6;
|
||||
ipLoading.value = false;
|
||||
// 拿到地址后并行做代理/VPN 检测(不阻塞主卡片)
|
||||
runProxyCheck();
|
||||
rtcProbe();
|
||||
}
|
||||
|
||||
// ---------- 代理/VPN 检测(出口 IP 判定 + WebRTC 泄漏检测,均免费) ----------
|
||||
const pcLoading = ref(false);
|
||||
const chk4 = ref<ChkInfo | null>(null); // v4 出口判定
|
||||
const chk6 = ref<ChkInfo | null>(null); // v6 出口判定
|
||||
const rtcPub = ref<string[]>([]); // STUN 实测公网候选(代理漏出的真实地址线索)
|
||||
const rtcLocal = ref<string[]>([]); // 本机内网候选
|
||||
const rtcState = ref<'wait' | 'run' | 'done'>('wait');
|
||||
|
||||
async function runProxyCheck() {
|
||||
if (!v4.value && !v6.value) return;
|
||||
pcLoading.value = true;
|
||||
const [c4, c6] = await Promise.all([
|
||||
v4.value ? jfetch(`/relay/ip-check?ip=${encodeURIComponent(v4.value)}`, 12000).catch(() => null) : null,
|
||||
v6.value ? jfetch(`/relay/ip-check?ip=${encodeURIComponent(v6.value)}`, 12000).catch(() => null) : null,
|
||||
]);
|
||||
chk4.value = (c4 && c4.data) || null;
|
||||
chk6.value = (c6 && c6.data) || null;
|
||||
pcLoading.value = false;
|
||||
}
|
||||
|
||||
// WebRTC 探测:STUN srflx 候选=公网(代理/VPN 漏洞常见线索);host 候选=本机内网 IP。
|
||||
// Chrome 会把 host 候选打成 mDNS(.local) 域名,此时内网 IP 显示为「浏览器隐私保护已隐藏」。
|
||||
async function rtcProbe() {
|
||||
if (typeof RTCPeerConnection === 'undefined') {
|
||||
rtcState.value = 'done';
|
||||
return;
|
||||
}
|
||||
rtcState.value = 'run';
|
||||
const pub = new Set<string>();
|
||||
const loc = new Set<string>();
|
||||
let pc: RTCPeerConnection;
|
||||
try {
|
||||
pc = new RTCPeerConnection({
|
||||
iceServers: [
|
||||
{ urls: 'stun:stun.l.google.com:19302' },
|
||||
{ urls: 'stun:stun1.l.google.com:19302' },
|
||||
],
|
||||
});
|
||||
} catch {
|
||||
rtcState.value = 'done';
|
||||
return;
|
||||
}
|
||||
try {
|
||||
pc.createDataChannel('probe');
|
||||
pc.onicecandidate = (e) => {
|
||||
if (!e.candidate) return;
|
||||
const m = /candidate:\S+ \d+ \S+ \d+ (\S+) \d+ typ (\w+)/.exec(e.candidate.candidate);
|
||||
if (!m) return;
|
||||
const ip = m[1].split('%')[0]; // 去 zone id
|
||||
const typ = m[2];
|
||||
if (ip.includes('.local')) return; // mDNS 伪地址,忽略
|
||||
if (typ === 'srflx') pub.add(ip);
|
||||
else if (typ === 'host') {
|
||||
const v4m = ip.match(/^(\d+)\./);
|
||||
const priv4 = v4m && ['10', '172', '192', '169'].includes(v4m[1]);
|
||||
const priv6 = ip.startsWith('fe80') || ip.startsWith('fc') || ip.startsWith('fd');
|
||||
if (ip.includes(':') ? priv6 : priv4) loc.add(ip); // 只留私网地址,公网 host 候选归入 pub 语义
|
||||
else pub.add(ip);
|
||||
}
|
||||
};
|
||||
pc.createOffer().then((o) => pc.setLocalDescription(o)).catch(() => {});
|
||||
await new Promise<void>((res) => {
|
||||
const to = setTimeout(res, 6000);
|
||||
pc.onicecandidate = ((orig) => (e: RTCPeerConnectionIceEvent) => {
|
||||
orig(e);
|
||||
if (!e.candidate) {
|
||||
clearTimeout(to);
|
||||
res();
|
||||
}
|
||||
})(pc.onicecandidate!);
|
||||
});
|
||||
} catch {
|
||||
/* 探测失败按无候选处理 */
|
||||
}
|
||||
try {
|
||||
pc.close();
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
rtcPub.value = [...pub];
|
||||
rtcLocal.value = [...loc];
|
||||
rtcState.value = 'done';
|
||||
}
|
||||
|
||||
// WebRTC 公网候选与主 IP 不一致的地址(可能的真实出口)
|
||||
const rtcMismatch = computed<string[]>(() => {
|
||||
const known = new Set([v4.value, v6.value].filter(Boolean));
|
||||
return rtcPub.value.filter((ip) => !known.has(ip));
|
||||
});
|
||||
|
||||
function chkVerdict(c: ChkInfo | null): { icon: string; text: string; cls: string } {
|
||||
if (pcLoading.value) return { icon: '⏳', text: '检测中…', cls: '' };
|
||||
if (!c) return { icon: '⚪', text: '无法判定(查询服务暂不可用)', cls: 'px-unknown' };
|
||||
if (c.lan) return { icon: '🏠', text: '内网地址,不适用代理判定', cls: '' };
|
||||
if (c.proxy) return { icon: '🔴', text: `检测到代理/VPN(${c.type}${c.provider ? ' · ' + c.provider : ''})`, cls: 'px-bad' };
|
||||
if (c.type === 'Business' || c.type === 'Hosting') {
|
||||
return { icon: '🟡', text: `${c.type === 'Hosting' ? '数据中心' : '企业'}网络出口,通常非家庭宽带`, cls: 'px-warn' };
|
||||
}
|
||||
return { icon: '🟢', text: `未检测到代理/VPN(${c.type || '家庭宽带线路'}${c.provider ? ' · ' + c.provider : ''})`, cls: 'px-ok' };
|
||||
}
|
||||
|
||||
function geoLine(g: Geo): string {
|
||||
@@ -513,6 +619,54 @@ onMounted(() => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 代理 / VPN 检测(出口 IP 判定 + WebRTC 泄漏检测) -->
|
||||
<div v-if="v4 || v6" class="sec">
|
||||
<div class="sec-head">
|
||||
<h3>🕵 代理 / VPN 检测</h3>
|
||||
<button class="sec-refresh" :disabled="pcLoading" @click="runProxyCheck()">
|
||||
{{ pcLoading ? '检测中…' : '重新检测' }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="px-rows">
|
||||
<div class="px-row">
|
||||
<span class="px-k">IPv4 出口判定</span>
|
||||
<span class="px-v" :class="chkVerdict(chk4).cls">{{ chkVerdict(chk4).icon }} {{ chkVerdict(chk4).text }}</span>
|
||||
</div>
|
||||
<div v-if="v6" class="px-row">
|
||||
<span class="px-k">IPv6 出口判定</span>
|
||||
<span class="px-v" :class="chkVerdict(chk6).cls">{{ chkVerdict(chk6).icon }} {{ chkVerdict(chk6).text }}</span>
|
||||
</div>
|
||||
<div class="px-row">
|
||||
<span class="px-k">WebRTC 实测公网地址</span>
|
||||
<span class="px-v">
|
||||
<template v-if="rtcState === 'run'">⏳ 探测中…</template>
|
||||
<template v-else-if="rtcPub.length">
|
||||
<code v-for="ip in rtcPub" :key="ip" class="px-ip">{{ ip }}</code>
|
||||
<template v-if="rtcMismatch.length">
|
||||
<span class="px-bad">⚠ 与上方 IP 不一致:{{ rtcMismatch.join('、') }} —— 浏览器经 STUN 拿到的另一公网地址,若你在用代理/VPN,这可能才是你的实际网络出口</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span class="px-ok">✓ 与上方一致</span>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>未检出(浏览器已禁用 WebRTC,或被代理软件/网络阻断 STUN)</template>
|
||||
</span>
|
||||
</div>
|
||||
<div class="px-row">
|
||||
<span class="px-k">本机内网 IP</span>
|
||||
<span class="px-v">
|
||||
<template v-if="rtcState === 'run'">⏳ 探测中…</template>
|
||||
<template v-else-if="rtcLocal.length">
|
||||
<code v-for="ip in rtcLocal" :key="ip" class="px-ip">{{ ip }}</code>
|
||||
</template>
|
||||
<template v-else-if="rtcState === 'done'">浏览器隐私保护已隐藏(现代 Chrome 默认用虚拟域名代替)</template>
|
||||
<template v-else>—</template>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="px-note">说明:浏览器无法直接读取系统代理软件的开关状态;判定依据为出口 IP 归属数据库(proxycheck.io)与 WebRTC 泄漏实测——高级代理/VPN 可能伪装归属地或阻断 STUN,结果仅供参考。</p>
|
||||
</div>
|
||||
|
||||
<!-- 热门地点延迟 -->
|
||||
<div class="sec">
|
||||
<div class="sec-head">
|
||||
@@ -876,6 +1030,88 @@ onMounted(() => {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
/* ---------- 代理/VPN 检测 ---------- */
|
||||
.px-rows {
|
||||
font-size: 14px;
|
||||
|
||||
.px-row {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 10px;
|
||||
padding: 7px 0;
|
||||
border-bottom: 1px dashed rgba(128, 128, 128, 0.18);
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.px-k {
|
||||
flex: 0 0 150px;
|
||||
opacity: 0.75;
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.px-v {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
line-height: 1.6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.px-ip {
|
||||
font-family: monospace;
|
||||
background: rgba(128, 128, 128, 0.12);
|
||||
padding: 1px 8px;
|
||||
border-radius: 6px;
|
||||
margin-right: 8px;
|
||||
font-size: 13px;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.px-ok {
|
||||
color: #18a058;
|
||||
}
|
||||
|
||||
.px-warn {
|
||||
color: #d0a000;
|
||||
}
|
||||
|
||||
.px-bad {
|
||||
color: #d03050;
|
||||
}
|
||||
|
||||
.px-unknown {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.px-note {
|
||||
margin-top: 8px;
|
||||
font-size: 12.5px;
|
||||
opacity: 0.65;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.sec-refresh {
|
||||
border: 1px solid rgba(128, 128, 128, 0.35);
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
border-radius: 8px;
|
||||
padding: 5px 14px;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
border-color: rgba(128, 128, 128, 0.7);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- 测速历史 ---------- */
|
||||
.sp-history {
|
||||
margin-top: 14px;
|
||||
|
||||
Reference in new issue
Block a user