1265 lines
38 KiB
Vue
1265 lines
38 KiB
Vue
<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);
|
||
const v4 = ref('');
|
||
const v4Geo = ref<Geo>(null);
|
||
const v6 = ref('');
|
||
const v6Geo = ref<Geo>(null);
|
||
const copied = ref('');
|
||
|
||
// 本站 IPv6 直连入口(4443 防封端口,AAAA 已指向本机原生 v6)
|
||
const V6_HOST = 'itv6.88531.cn';
|
||
const V6_PORT = 4443;
|
||
const onV6Host = location.hostname === V6_HOST;
|
||
const onPublicHost = location.hostname === 'it.88531.cn' || onV6Host;
|
||
|
||
function switchToV6() {
|
||
window.open(`https://${V6_HOST}:${V6_PORT}/my-ip`, '_self');
|
||
}
|
||
|
||
async function jfetch(url: string, ms = 8000): Promise<any> {
|
||
const ctrl = new AbortController();
|
||
const t = setTimeout(() => ctrl.abort(), ms);
|
||
try {
|
||
const r = await fetch(url, { cache: 'no-store', signal: ctrl.signal });
|
||
if (!r.ok) throw new Error('HTTP ' + r.status);
|
||
return await r.json();
|
||
} finally {
|
||
clearTimeout(t);
|
||
}
|
||
}
|
||
|
||
async function tfetch(url: string, ms = 6000): Promise<string> {
|
||
const ctrl = new AbortController();
|
||
const t = setTimeout(() => ctrl.abort(), ms);
|
||
try {
|
||
const r = await fetch(url, { cache: 'no-store', signal: ctrl.signal });
|
||
if (!r.ok) throw new Error('HTTP ' + r.status);
|
||
const txt = (await r.text()).trim();
|
||
if (txt.startsWith('{')) {
|
||
try {
|
||
const j = JSON.parse(txt);
|
||
return String(j.ip || '');
|
||
} catch {
|
||
/* 非 JSON 就当纯文本 */
|
||
}
|
||
}
|
||
return txt;
|
||
} finally {
|
||
clearTimeout(t);
|
||
}
|
||
}
|
||
|
||
async function firstOf(urls: string[]): Promise<string> {
|
||
for (const u of urls) {
|
||
try {
|
||
const ip = await tfetch(u);
|
||
if (ip) return ip;
|
||
} catch {
|
||
/* 换下一个源 */
|
||
}
|
||
}
|
||
return '';
|
||
}
|
||
|
||
const V4_SRC = ['https://v4.ident.me/', 'https://api.ipify.org?format=json', 'https://ip.3322.org/'];
|
||
// IPv6 多源并发:任一源返回含冒号的地址即认为支持(防中间页劫持 + 双栈源误判)
|
||
const V6_SRC = ['https://api6.ipify.org?format=json', 'https://v6.ident.me/'];
|
||
|
||
function isV6(s: string): boolean {
|
||
return s.includes(':');
|
||
}
|
||
|
||
async function geoFor(ip: string): Promise<Geo> {
|
||
if (!ip) return null;
|
||
try {
|
||
const j = await jfetch(`/relay/ip-geo?ip=${encodeURIComponent(ip)}`, 9000);
|
||
return (j && j.data) || null;
|
||
} catch {
|
||
return null;
|
||
}
|
||
}
|
||
|
||
async function loadIps() {
|
||
ipLoading.value = true;
|
||
// 用户端 IPv4/IPv6 全部由浏览器向外部 IP 服务实测(与服务器无关)
|
||
const [t4, t6s] = await Promise.all([
|
||
firstOf(V4_SRC),
|
||
Promise.all(V6_SRC.map((u) => tfetch(u).catch(() => ''))),
|
||
]);
|
||
v4.value = t4;
|
||
// IPv6 必须含冒号才认(双栈源在无 v6 网络下会返回 v4)
|
||
v6.value = t6s.find(isV6) || '';
|
||
const [g4, g6] = await Promise.all([geoFor(v4.value), geoFor(v6.value)]);
|
||
v4Geo.value = g4;
|
||
v6Geo.value = g6;
|
||
ipLoading.value = false;
|
||
ensureIspNode(); // 归属运营商已知 → 插入「本省运营商门户」延迟节点并补测
|
||
// 拿到地址后并行做代理/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 {
|
||
if (!g) return '';
|
||
if (g.lan) return '内网地址(局域网),无公网归属地';
|
||
const place = [g.country, g.region, g.city].filter(Boolean).join(' · ');
|
||
const isp = g.isp ? ` · ${g.isp}` : '';
|
||
const asn = g.as ? `(${g.as})` : '';
|
||
return (place || '未知归属地') + isp + asn;
|
||
}
|
||
|
||
async function copyIp(text: string, key: string) {
|
||
if (!text) return;
|
||
try {
|
||
await navigator.clipboard.writeText(text);
|
||
} catch {
|
||
const ta = document.createElement('textarea');
|
||
ta.value = text;
|
||
document.body.appendChild(ta);
|
||
ta.select();
|
||
try {
|
||
document.execCommand('copy');
|
||
} catch {
|
||
/* ignore */
|
||
}
|
||
document.body.removeChild(ta);
|
||
}
|
||
copied.value = key;
|
||
setTimeout(() => {
|
||
if (copied.value === key) copied.value = '';
|
||
}, 1500);
|
||
}
|
||
|
||
// ---------- 热门地点延迟(你的浏览器到各地点的实测延迟) ----------
|
||
type LatNode = { name: string; url: string; ms: number | null; st: 'wait' | 'run' | 'ok' | 'fail'; note?: string };
|
||
const latTesting = ref(false);
|
||
const nodes = ref<LatNode[]>([
|
||
{ name: '本站服务器', url: `${location.origin}/favicon.ico`, ms: null, st: 'wait' },
|
||
{ name: '百度', url: 'https://www.baidu.com/favicon.ico', ms: null, st: 'wait' },
|
||
{ name: '清华 TUNA(北京)', url: 'https://mirrors.tuna.tsinghua.edu.cn/', ms: null, st: 'wait' },
|
||
{ name: '阿里云镜像(杭州)', url: 'https://mirrors.aliyun.com/', ms: null, st: 'wait' },
|
||
{ name: '腾讯云镜像(广州)', url: 'https://mirrors.cloud.tencent.com/', ms: null, st: 'wait' },
|
||
{ name: '华为云镜像', url: 'https://mirrors.huaweicloud.com/', ms: null, st: 'wait' },
|
||
{ name: '中科大 USTC(合肥)', url: 'https://mirrors.ustc.edu.cn/', ms: null, st: 'wait' },
|
||
{ name: '香港 Fedora', url: 'https://mirror.hk.fedoraproject.org/', ms: null, st: 'wait' },
|
||
{ name: '日本 JAIST', url: 'https://mirror.jaist.ac.jp/', ms: null, st: 'wait' },
|
||
{ name: 'Cloudflare(海外)', url: 'https://speed.cloudflare.com/__down?bytes=0', ms: null, st: 'wait' },
|
||
]);
|
||
|
||
// 按用户 IPv4 归属运营商动态插入「本省运营商门户」节点(三大运营商+广电,无匹配则不插)
|
||
function ensureIspNode() {
|
||
if (nodes.value.some((n) => n.name.startsWith('本省'))) return;
|
||
const g = v4Geo.value;
|
||
const isp = `${g?.isp || ''} ${g?.as || ''}`;
|
||
const province = g?.regionName || '';
|
||
let portal = '';
|
||
let short = '';
|
||
if (/联通|Unicom/i.test(isp)) {
|
||
portal = 'https://www.10010.com/favicon.ico'; // favicon 直链无 302;首页会被风控挂到超时
|
||
short = '联通';
|
||
} else if (/电信|Telecom/i.test(isp)) {
|
||
portal = 'https://www.189.cn/favicon.ico';
|
||
short = '电信';
|
||
} else if (/移动|Mobile|铁通|Tietong/i.test(isp)) {
|
||
portal = 'https://www.10086.cn/'; // 移动 favicon 不可达,用首页(200 稳定)
|
||
short = '移动';
|
||
} else if (/广电|Broadnet/i.test(isp)) {
|
||
portal = 'https://www.10099.com.cn/favicon.ico';
|
||
short = '广电';
|
||
}
|
||
if (!portal) return; // 未知运营商(教育网/长城等)不插行
|
||
const node: LatNode = { name: `本省·${short}`, url: portal, ms: null, st: 'wait', note: province ? `${g?.isp || short} · ${province}` : (g?.isp || '') };
|
||
nodes.value.splice(1, 0, node);
|
||
ping(node); // 其余节点已在测,单独补测这一项
|
||
}
|
||
|
||
const latSummary = computed(() => {
|
||
const ok = nodes.value.filter((n) => n.st === 'ok' && n.ms != null);
|
||
if (!ok.length) return '';
|
||
const avg = Math.round(ok.reduce((s, n) => s + (n.ms || 0), 0) / ok.length);
|
||
const best = Math.min(...ok.map((n) => n.ms || 0));
|
||
return `平均 ${avg} ms · 最快 ${best} ms · ${ok.length}/${nodes.value.length} 个节点可达`;
|
||
});
|
||
|
||
async function ping(n: LatNode) {
|
||
n.st = 'run';
|
||
const ctrl = new AbortController();
|
||
const timer = setTimeout(() => ctrl.abort(), 8000);
|
||
const t0 = performance.now();
|
||
try {
|
||
const same = n.url.startsWith(location.origin);
|
||
await fetch(n.url + (n.url.includes('?') ? '&' : '?') + '_t=' + Date.now(), {
|
||
mode: same ? 'cors' : 'no-cors',
|
||
cache: 'no-store',
|
||
signal: ctrl.signal,
|
||
});
|
||
n.ms = Math.round(performance.now() - t0);
|
||
n.st = 'ok';
|
||
} catch {
|
||
n.ms = null;
|
||
n.st = 'fail';
|
||
} finally {
|
||
clearTimeout(timer);
|
||
}
|
||
}
|
||
|
||
async function runAllLatency() {
|
||
if (latTesting.value) return;
|
||
latTesting.value = true;
|
||
await Promise.all(nodes.value.map(ping));
|
||
latTesting.value = false;
|
||
}
|
||
|
||
function latCls(n: LatNode): string {
|
||
if (n.st === 'fail') return 'is-fail';
|
||
if (n.st !== 'ok' || n.ms == null) return 'is-wait';
|
||
if (n.ms < 60) return 'is-good';
|
||
if (n.ms < 150) return 'is-ok';
|
||
if (n.ms < 300) return 'is-mid';
|
||
return 'is-slow';
|
||
}
|
||
|
||
// ---------- 网速测试(你的浏览器 <-> 本站服务器,真实收发数据计时) ----------
|
||
const SPEED_BASE = `${location.origin}/relay/speed`;
|
||
const sp = ref<'idle' | 'down' | 'up' | 'done' | 'error'>('idle');
|
||
const spPct = ref(0);
|
||
const spBytes = ref(0);
|
||
const downMbps = ref(0);
|
||
const upMbps = ref(0);
|
||
const serverMs = ref<number | null>(null);
|
||
const spMsg = ref('');
|
||
|
||
const transferredMb = computed(() => (spBytes.value / 1048576).toFixed(1));
|
||
|
||
async function fetchBytes(url: string, ms = 30000) {
|
||
const ctrl = new AbortController();
|
||
const t = setTimeout(() => ctrl.abort(), ms);
|
||
try {
|
||
const r = await fetch(url, { cache: 'no-store', signal: ctrl.signal });
|
||
if (!r.ok) throw new Error('HTTP ' + r.status);
|
||
const buf = await r.arrayBuffer();
|
||
return buf.byteLength;
|
||
} finally {
|
||
clearTimeout(t);
|
||
}
|
||
}
|
||
|
||
function randBuf(len: number): ArrayBuffer {
|
||
const buf = new Uint8Array(len);
|
||
const W = 65536;
|
||
for (let o = 0; o < len; o += W) crypto.getRandomValues(buf.subarray(o, Math.min(o + W, len)));
|
||
return buf.buffer as ArrayBuffer;
|
||
}
|
||
|
||
async function runSpeedTest() {
|
||
if (sp.value === 'down' || sp.value === 'up') return;
|
||
sp.value = 'down';
|
||
spPct.value = 0;
|
||
spBytes.value = 0;
|
||
downMbps.value = 0;
|
||
upMbps.value = 0;
|
||
spMsg.value = '';
|
||
try {
|
||
// 1) 到本站服务器的延迟(一次小请求计时)
|
||
const l0 = performance.now();
|
||
await fetchBytes(`${SPEED_BASE}?bytes=4096&_t=${Date.now()}`, 10000);
|
||
serverMs.value = Math.max(1, Math.round(performance.now() - l0));
|
||
|
||
// 2) 下载:预热 512KB 不计速,再 3 轮 × 3MB 计总吞吐
|
||
await fetchBytes(`${SPEED_BASE}?bytes=524288&_t=${Date.now()}`, 20000);
|
||
const DCH = 3 * 1024 * 1024;
|
||
let got = 0;
|
||
const t0 = performance.now();
|
||
for (let i = 0; i < 3; ++i) {
|
||
const gotChunk = await fetchBytes(`${SPEED_BASE}?bytes=${DCH}&_t=${Date.now() + i}`);
|
||
got += gotChunk;
|
||
spBytes.value = got;
|
||
spPct.value = 10 + Math.round(((i + 1) / 3) * 48);
|
||
}
|
||
const del = (performance.now() - t0) / 1000;
|
||
downMbps.value = Math.round((got * 8) / del / 1e4) / 100;
|
||
|
||
// 3) 上传:预热 256KB 不计速,再 3 轮 × 1MB 随机数据(服务器收满丢弃)
|
||
sp.value = 'up';
|
||
await postBytes(randBuf(256 * 1024), 20000);
|
||
const UCH = 1024 * 1024;
|
||
const payload = randBuf(UCH);
|
||
let sent = 0;
|
||
const u0 = performance.now();
|
||
for (let i = 0; i < 3; ++i) {
|
||
const n = await postBytes(payload, 30000);
|
||
sent += n;
|
||
spBytes.value = got + sent;
|
||
spPct.value = 58 + Math.round(((i + 1) / 3) * 42);
|
||
}
|
||
const uel = (performance.now() - u0) / 1000;
|
||
upMbps.value = Math.round((sent * 8) / uel / 1e4) / 100;
|
||
spPct.value = 100;
|
||
sp.value = 'done';
|
||
pushSpeedRec(); // 记入本机测速历史,方便多线路对比
|
||
} catch (e: any) {
|
||
sp.value = 'error';
|
||
spMsg.value =
|
||
e && e.name === 'AbortError'
|
||
? '测速超时:到本站服务器连接超时,请稍后重试'
|
||
: '测速失败:无法连接本站服务器测速接口,请稍后重试';
|
||
}
|
||
}
|
||
|
||
async function postBytes(buf: ArrayBuffer, ms = 30000): Promise<number> {
|
||
const ctrl = new AbortController();
|
||
const timer = setTimeout(() => ctrl.abort(), ms);
|
||
try {
|
||
const r = await fetch(SPEED_BASE, {
|
||
method: 'POST',
|
||
mode: 'cors',
|
||
cache: 'no-store',
|
||
headers: { 'Content-Type': 'application/octet-stream' },
|
||
body: buf,
|
||
signal: ctrl.signal,
|
||
});
|
||
if (!r.ok) throw new Error('HTTP ' + r.status);
|
||
const j = await r.json().catch(() => null);
|
||
return (j && j.data && j.data.received) || buf.byteLength;
|
||
} finally {
|
||
clearTimeout(timer);
|
||
}
|
||
}
|
||
|
||
function grade(mbps: number): string {
|
||
if (mbps >= 200) return '🚀 极速:多路 4K / 秒下大文件';
|
||
if (mbps >= 100) return '⚡ 很快:4K 视频与大文件下载流畅';
|
||
if (mbps >= 50) return '✅ 良好:1080p~4K 视频流畅';
|
||
if (mbps >= 20) return '👍 中等:1080p 视频流畅';
|
||
if (mbps >= 10) return '📶 偏慢:720p 视频可用';
|
||
return '🐢 较慢:建议检查网络或更换线路';
|
||
}
|
||
|
||
// ---------- 测速历史(存本机浏览器 localStorage,按线路对比,最多 20 条) ----------
|
||
const SPEED_HISTORY_KEY = 'itp_my_ip_speed_history';
|
||
interface SpeedRec {
|
||
t: number; // 时间戳
|
||
down: number; // 下载 Mbps
|
||
up: number; // 上传 Mbps
|
||
ms: number; // 到本站延迟
|
||
route: 'IPv6 直连' | '公网中转'; // 测试时所走线路
|
||
host: string; // 测试时的访问域名
|
||
lat?: string; // 测速时点的热门地点延迟快照:"百度5 本省联通6 清华12 …"(空串=当时未测完)
|
||
}
|
||
const speedHistory = ref<SpeedRec[]>([]);
|
||
|
||
function loadSpeedHistory() {
|
||
try {
|
||
const arr = JSON.parse(localStorage.getItem(SPEED_HISTORY_KEY) || '[]');
|
||
speedHistory.value = Array.isArray(arr)
|
||
? arr.filter((r) => r && typeof r.down === 'number' && typeof r.t === 'number').slice(0, 20)
|
||
: [];
|
||
} catch {
|
||
speedHistory.value = [];
|
||
}
|
||
}
|
||
|
||
function saveSpeedHistory() {
|
||
try {
|
||
localStorage.setItem(SPEED_HISTORY_KEY, JSON.stringify(speedHistory.value.slice(0, 20)));
|
||
} catch {
|
||
/* 隐私模式下写入失败则仅本次会话展示 */
|
||
}
|
||
}
|
||
|
||
// 把当前热门地点延迟压成短串快照(写入历史记录):"百度5 本省联通6 清华12 …"
|
||
function latSnapshot(): string {
|
||
return nodes.value
|
||
.filter((n) => n.st === 'ok' && n.ms != null)
|
||
.map((n) => `${n.name.replace(/([^)]*)/g, '').replace(/[\s·]/g, '')}${n.ms}`)
|
||
.join(' ');
|
||
}
|
||
|
||
function pushSpeedRec() {
|
||
speedHistory.value.unshift({
|
||
t: Date.now(),
|
||
down: downMbps.value,
|
||
up: upMbps.value,
|
||
ms: serverMs.value ?? 0,
|
||
route: onV6Host ? 'IPv6 直连' : '公网中转',
|
||
host: location.host,
|
||
lat: latSnapshot(),
|
||
});
|
||
speedHistory.value = speedHistory.value.slice(0, 20);
|
||
saveSpeedHistory();
|
||
}
|
||
|
||
function clearSpeedHistory() {
|
||
speedHistory.value = [];
|
||
saveSpeedHistory();
|
||
}
|
||
|
||
function fmtTime(t: number): string {
|
||
const d = new Date(t);
|
||
const p = (n: number) => String(n).padStart(2, '0');
|
||
return `${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`;
|
||
}
|
||
|
||
onMounted(() => {
|
||
loadIps();
|
||
runAllLatency();
|
||
loadSpeedHistory();
|
||
});
|
||
</script>
|
||
|
||
<template>
|
||
<div class="myip-root">
|
||
<!-- 本站 IPv6 直连横幅 -->
|
||
<div v-if="v6 && onPublicHost && !onV6Host" class="v6-banner ok">
|
||
<div class="vb-text">
|
||
<b>本站已支持 IPv6 访问,速度更快</b>
|
||
<span>检测到你的网络支持 IPv6。本站已开通 IPv6 直连(免公网中转),切换后访问本站更快、延迟更低。</span>
|
||
</div>
|
||
<button class="vb-btn" @click="switchToV6()">切换 IPv6 直连</button>
|
||
</div>
|
||
<div v-else-if="onV6Host" class="v6-banner ok">
|
||
<div class="vb-text">
|
||
<b>当前已通过 IPv6 直连访问本站</b>
|
||
<span>你正走 IPv6 直连线路(免公网中转),访问本站速度更快、延迟更低。</span>
|
||
</div>
|
||
</div>
|
||
<div v-else-if="!v6 && !ipLoading" class="v6-banner info">
|
||
<div class="vb-text">
|
||
<b>本站已支持 IPv6 访问,速度更快</b>
|
||
<span>你的网络暂未检测到 IPv6 地址。按下方「如何开启 IPv6」开通后即可直连本站。</span>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 用户端 IP 卡片(IPv4 / IPv6,均为你的设备视角) -->
|
||
<div class="ip-row">
|
||
<div class="ip-card">
|
||
<div class="ip-card-head">
|
||
<span class="ip-tag v4">IPv4</span>
|
||
<span class="ip-label">你的公网地址</span>
|
||
<button class="copy-btn" :disabled="!v4" @click="copyIp(v4, 'v4')">
|
||
{{ copied === 'v4' ? '✓ 已复制' : '复制' }}
|
||
</button>
|
||
</div>
|
||
<div class="ip-value" :class="{ loading: ipLoading && !v4 }">
|
||
{{ v4 || (ipLoading ? '查询中…' : '未获取到(网络可能屏蔽了 IP 查询服务)') }}
|
||
</div>
|
||
<div class="ip-geo">{{ geoLine(v4Geo) }}</div>
|
||
</div>
|
||
|
||
<div class="ip-card">
|
||
<div class="ip-card-head">
|
||
<span class="ip-tag v6">IPv6</span>
|
||
<span class="ip-label">你的公网地址</span>
|
||
<button class="copy-btn" :disabled="!v6" @click="copyIp(v6, 'v6')">
|
||
{{ copied === 'v6' ? '✓ 已复制' : '复制' }}
|
||
</button>
|
||
</div>
|
||
<div v-if="v6" class="ip-value" :class="{ loading: ipLoading && !v6 }">{{ v6 }}</div>
|
||
<div v-else class="ip-value unsupported">
|
||
{{ ipLoading ? '检测中…' : '不支持 IPv6' }}
|
||
</div>
|
||
<div class="ip-geo">{{ v6 ? geoLine(v6Geo) : ipLoading ? '' : '你的网络未检测到 IPv6 地址(运营商或路由器未开启 IPv6)' }}</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="ip-hint">
|
||
进入页面自动查询:IPv4/IPv6 地址均由你的浏览器向外部 IP 服务实测(多源容错),归属地由本站服务端按你的 IP 查询(中文数据);点击卡片右上角「复制」可复制地址。
|
||
<button class="refresh-btn" :disabled="ipLoading" @click="loadIps()">{{ ipLoading ? '刷新中…' : '刷新 IP' }}</button>
|
||
</div>
|
||
|
||
<!-- 如何开启 IPv6(不支持时展示) -->
|
||
<div v-if="!v6 && !ipLoading" class="sec guide">
|
||
<div class="sec-head"><h3>如何开启 IPv6?</h3><span class="sec-sub">按顺序检查,多数家宽用户开完第 ② ③ 步即可获得 IPv6</span></div>
|
||
<ol class="guide-list">
|
||
<li><b>① 运营商侧确认已开通</b>:电信/移动/联通家宽默认已启用 IPv6,不确定就打客服电话报"开通 IPv6"。</li>
|
||
<li><b>② 光猫改桥接或开双栈</b>:登录光猫管理页(常为 192.168.1.1),上网方式改"桥接"(推荐,由路由器拨号),或把连接模式改为"双栈"。</li>
|
||
<li><b>③ 路由器开启 IPv6</b>:路由器外网/WAN 设置里启用 IPv6,方式选 Native(原生)或 Dual-Stack(双栈),LAN 侧会自动向下分发 v6 前缀。</li>
|
||
<li><b>④ 终端确认拿到地址</b>:Windows 在 网络适配器属性 里查看"IPv6 地址";手机在 Wi-Fi 详情里查看。没有就重连 Wi-Fi/重启路由器。</li>
|
||
<li><b>⑤ 回到本页刷新</b>:IPv6 卡显示地址即成功,顶部会出现「切换 IPv6 直连」入口。</li>
|
||
</ol>
|
||
</div>
|
||
|
||
<!-- 网速测试(你的设备 <-> 本站服务器真实收发) -->
|
||
<div class="sec">
|
||
<div class="sec-head">
|
||
<h3>网速测试(你的设备 ↔ 本站服务器)</h3>
|
||
<span class="sec-sub">从你的浏览器向本站服务器真实收发数据并计时,测的是你连接本站服务器的实际速度(走你当前的访问线路:公网中转或 IPv6 直连),约消耗 13MB 流量</span>
|
||
<n-button
|
||
size="large"
|
||
type="primary"
|
||
:loading="sp === 'down' || sp === 'up'"
|
||
@click="runSpeedTest()"
|
||
>
|
||
{{ sp === 'idle' ? '开始测速' : sp === 'down' ? '测速中(下载)…' : sp === 'up' ? '测速中(上传)…' : '重新测速' }}
|
||
</n-button>
|
||
</div>
|
||
<div class="sp-bar">
|
||
<div class="sp-fill" :style="{ width: spPct + '%' }"></div>
|
||
</div>
|
||
<div class="sp-meta">
|
||
<span v-if="sp === 'down' || sp === 'up'">测速中,已传输 {{ transferredMb }} MB…</span>
|
||
<span v-else-if="sp === 'done'">测速完成 · 共传输 {{ transferredMb }} MB</span>
|
||
<span v-else-if="sp === 'error'">—</span>
|
||
<span v-else>点击「开始测速」后自动进行延迟、下载与上传测试</span>
|
||
</div>
|
||
<div class="sp-results">
|
||
<div class="sp-item">
|
||
<div class="sp-num">{{ downMbps || '—' }}</div>
|
||
<div class="sp-unit">Mbps 下载速度</div>
|
||
<div class="sp-grade">{{ downMbps ? grade(downMbps) : '' }}</div>
|
||
</div>
|
||
<div class="sp-item">
|
||
<div class="sp-num up">{{ upMbps || '—' }}</div>
|
||
<div class="sp-unit">Mbps 上传速度</div>
|
||
<div class="sp-grade">{{ upMbps ? grade(upMbps) : '' }}</div>
|
||
</div>
|
||
<div class="sp-item">
|
||
<div class="sp-num ms">{{ serverMs ?? '—' }}</div>
|
||
<div class="sp-unit">ms 到本站服务器延迟</div>
|
||
<div class="sp-grade">{{ serverMs ? (serverMs < 50 ? '🟢 延迟很低' : serverMs < 150 ? '🟡 延迟正常' : '🔴 延迟偏高') : '' }}</div>
|
||
</div>
|
||
<div class="sp-item tip">
|
||
<div class="sp-tip-t">测速原理</div>
|
||
<div class="sp-tip">下载从本站服务器拉取固定大小数据块计时,上传向本站服务器推送随机数据块计时,结果为你到本站服务器的实际吞吐。切换 IPv6 直连后重测可对比两条线路的差距。</div>
|
||
</div>
|
||
</div>
|
||
<div v-if="sp === 'error'" class="sp-error">{{ spMsg }}</div>
|
||
|
||
<!-- 测速历史(存本机浏览器,按线路对比) -->
|
||
<div v-if="speedHistory.length" class="sp-history">
|
||
<div class="sp-hist-head">
|
||
<span class="sp-hist-t">📋 测速历史(仅存于你的浏览器,共 {{ speedHistory.length }} 条,最多保留 20 条)</span>
|
||
<n-button size="small" quaternary @click="clearSpeedHistory()">清空历史</n-button>
|
||
</div>
|
||
<div class="sp-hist-table">
|
||
<div class="sp-hrow sp-hhead">
|
||
<span>时间</span>
|
||
<span>线路</span>
|
||
<span>下载 Mbps</span>
|
||
<span>上传 Mbps</span>
|
||
<span>延迟 ms</span>
|
||
<span>热门地点延迟快照</span>
|
||
</div>
|
||
<div v-for="r in speedHistory" :key="r.t" class="sp-hrow">
|
||
<span>{{ fmtTime(r.t) }}</span>
|
||
<span><em :class="r.route === 'IPv6 直连' ? 'tag-v6' : 'tag-v4'">{{ r.route }}</em></span>
|
||
<span class="c-down">{{ r.down }}</span>
|
||
<span class="c-up">{{ r.up }}</span>
|
||
<span class="c-ms">{{ r.ms }}</span>
|
||
<span class="c-lat">{{ r.lat || '—' }}</span>
|
||
</div>
|
||
</div>
|
||
<div class="sp-hist-tip">对比方法:在当前线路测一次 → 点横幅「切换 IPv6 直连」再测一次,下载/上传/延迟与各地点(百度/本省运营商/镜像站等)延迟直接在表里对照。</div>
|
||
</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">
|
||
<h3>连接热门地点的速度</h3>
|
||
<span class="sec-sub">进入页面自动测量你的浏览器到各地点的网络延迟(越低越快,点「重新测速」再测一轮)</span>
|
||
<n-button size="large" :loading="latTesting" @click="runAllLatency()">重新测速</n-button>
|
||
</div>
|
||
<div class="lat-grid">
|
||
<div v-for="n in nodes" :key="n.name" class="lat-card" :class="latCls(n)">
|
||
<span class="lat-name" :title="n.note || ''">{{ n.name }}</span>
|
||
<span class="lat-ms">
|
||
{{ n.st === 'run' ? '测速中…' : n.st === 'fail' ? '超时' : n.st === 'ok' ? `${n.ms} ms` : '待测' }}
|
||
</span>
|
||
</div>
|
||
</div>
|
||
<div class="lat-summary">{{ latSummary }}</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<style scoped lang="less">
|
||
.myip-root {
|
||
min-height: calc(100vh - 170px);
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 18px;
|
||
font-size: 15px;
|
||
color: #1f2a44;
|
||
}
|
||
|
||
/* ---- IPv6 直连横幅 ---- */
|
||
.v6-banner {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 16px;
|
||
border-radius: 12px;
|
||
padding: 14px 18px;
|
||
flex-wrap: wrap;
|
||
&.ok {
|
||
background: #e9fbf1;
|
||
border: 1px solid #a7e8c6;
|
||
.vb-text b {
|
||
color: #0d9f57;
|
||
}
|
||
}
|
||
&.info {
|
||
background: #eef4ff;
|
||
border: 1px solid #c3d6f7;
|
||
.vb-text b {
|
||
color: #1d6fe0;
|
||
}
|
||
}
|
||
}
|
||
.vb-text {
|
||
flex: 1;
|
||
min-width: 240px;
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 2px;
|
||
b {
|
||
font-size: 16px;
|
||
}
|
||
span {
|
||
color: #46557a;
|
||
font-size: 14.5px;
|
||
line-height: 1.5;
|
||
}
|
||
}
|
||
.vb-btn {
|
||
font-size: 15px;
|
||
font-weight: 600;
|
||
padding: 8px 18px;
|
||
border-radius: 9px;
|
||
border: none;
|
||
background: #0d9f57;
|
||
color: #fff;
|
||
cursor: pointer;
|
||
white-space: nowrap;
|
||
transition: all 0.15s;
|
||
&:hover {
|
||
background: #0b8a4b;
|
||
}
|
||
}
|
||
|
||
/* ---- IP 卡片 ---- */
|
||
.ip-row {
|
||
display: grid;
|
||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||
gap: 14px;
|
||
}
|
||
.ip-card {
|
||
border: 1px solid #e5e9f2;
|
||
border-radius: 12px;
|
||
padding: 16px 18px;
|
||
background: #fff;
|
||
box-shadow: 0 1px 4px rgba(30, 60, 110, 0.05);
|
||
}
|
||
.ip-card-head {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
margin-bottom: 10px;
|
||
}
|
||
.ip-tag {
|
||
font-size: 13px;
|
||
font-weight: 700;
|
||
padding: 2px 9px;
|
||
border-radius: 6px;
|
||
&.v4 {
|
||
background: #e8f3ff;
|
||
color: #1d6fe0;
|
||
}
|
||
&.v6 {
|
||
background: #e9fbf1;
|
||
color: #0d9f57;
|
||
}
|
||
}
|
||
.ip-label {
|
||
color: #5b6b85;
|
||
font-size: 14.5px;
|
||
}
|
||
.copy-btn {
|
||
margin-left: auto;
|
||
font-size: 14px;
|
||
padding: 4px 12px;
|
||
border-radius: 8px;
|
||
border: 1px solid #cfd8ea;
|
||
background: #fff;
|
||
color: #1d6fe0;
|
||
cursor: pointer;
|
||
transition: all 0.15s;
|
||
&:hover:not(:disabled) {
|
||
background: #e8f3ff;
|
||
border-color: #1d6fe0;
|
||
}
|
||
&:disabled {
|
||
opacity: 0.4;
|
||
cursor: not-allowed;
|
||
}
|
||
}
|
||
.ip-value {
|
||
font-family: ui-monospace, 'SF Mono', Consolas, monospace;
|
||
font-size: 22px;
|
||
font-weight: 600;
|
||
word-break: break-all;
|
||
line-height: 1.35;
|
||
min-height: 30px;
|
||
&.loading {
|
||
color: #94a3b8;
|
||
font-size: 16px;
|
||
font-weight: 400;
|
||
}
|
||
&.unsupported {
|
||
color: #dc2626;
|
||
font-family: inherit;
|
||
font-size: 19px;
|
||
}
|
||
}
|
||
.ip-geo {
|
||
margin-top: 8px;
|
||
color: #5b6b85;
|
||
font-size: 14.5px;
|
||
min-height: 21px;
|
||
line-height: 1.45;
|
||
}
|
||
.ip-hint {
|
||
color: #5b6b85;
|
||
font-size: 14.5px;
|
||
line-height: 1.6;
|
||
}
|
||
.refresh-btn {
|
||
margin-left: 8px;
|
||
font-size: 14px;
|
||
padding: 3px 12px;
|
||
border-radius: 8px;
|
||
border: 1px solid #cfd8ea;
|
||
background: #fff;
|
||
color: #1d6fe0;
|
||
cursor: pointer;
|
||
&:hover:not(:disabled) {
|
||
background: #e8f3ff;
|
||
}
|
||
&:disabled {
|
||
opacity: 0.5;
|
||
cursor: not-allowed;
|
||
}
|
||
}
|
||
|
||
/* ---- 通用区块 ---- */
|
||
.sec {
|
||
border: 1px solid #e5e9f2;
|
||
border-radius: 12px;
|
||
padding: 18px 20px;
|
||
background: #fff;
|
||
flex: 1;
|
||
}
|
||
.sec-head {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 14px;
|
||
flex-wrap: wrap;
|
||
margin-bottom: 14px;
|
||
h3 {
|
||
margin: 0;
|
||
font-size: 19px;
|
||
white-space: nowrap;
|
||
}
|
||
}
|
||
.sec-sub {
|
||
color: #5b6b85;
|
||
font-size: 14.5px;
|
||
flex: 1;
|
||
min-width: 220px;
|
||
line-height: 1.5;
|
||
}
|
||
|
||
/* ---- IPv6 开启教学 ---- */
|
||
.guide-list {
|
||
margin: 0;
|
||
padding-left: 20px;
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 8px;
|
||
li {
|
||
font-size: 15px;
|
||
line-height: 1.65;
|
||
color: #33415c;
|
||
b {
|
||
color: #1f2a44;
|
||
}
|
||
}
|
||
}
|
||
|
||
/* ---- 延迟网格 ---- */
|
||
.lat-grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
|
||
gap: 12px;
|
||
}
|
||
.lat-card {
|
||
border: 1px solid #e8edf6;
|
||
border-radius: 10px;
|
||
padding: 12px 14px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 8px;
|
||
background: #fafcff;
|
||
}
|
||
.lat-name {
|
||
font-size: 14.5px;
|
||
color: #33415c;
|
||
}
|
||
.lat-ms {
|
||
font-size: 17px;
|
||
font-weight: 700;
|
||
font-variant-numeric: tabular-nums;
|
||
white-space: nowrap;
|
||
}
|
||
.is-good .lat-ms {
|
||
color: #0d9f57;
|
||
}
|
||
.is-ok .lat-ms {
|
||
color: #1d6fe0;
|
||
}
|
||
.is-mid .lat-ms {
|
||
color: #d97706;
|
||
}
|
||
.is-slow .lat-ms {
|
||
color: #dc2626;
|
||
}
|
||
.is-fail .lat-ms,
|
||
.is-wait .lat-ms {
|
||
color: #94a3b8;
|
||
font-size: 14.5px;
|
||
font-weight: 500;
|
||
}
|
||
.is-fail {
|
||
background: #fff5f5;
|
||
}
|
||
.lat-summary {
|
||
margin-top: 12px;
|
||
color: #5b6b85;
|
||
font-size: 14.5px;
|
||
min-height: 21px;
|
||
}
|
||
|
||
/* ---- 网速 ---- */
|
||
.sp-bar {
|
||
height: 14px;
|
||
background: #eef2f8;
|
||
border-radius: 8px;
|
||
overflow: hidden;
|
||
margin: 6px 0 10px;
|
||
}
|
||
.sp-fill {
|
||
height: 100%;
|
||
width: 0;
|
||
background: linear-gradient(90deg, #1d6fe0, #0d9f57);
|
||
transition: width 0.3s;
|
||
}
|
||
.sp-meta {
|
||
color: #5b6b85;
|
||
font-size: 14.5px;
|
||
margin-bottom: 14px;
|
||
min-height: 21px;
|
||
}
|
||
.sp-results {
|
||
display: grid;
|
||
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
|
||
gap: 14px;
|
||
}
|
||
.sp-item {
|
||
background: #f7f9fd;
|
||
border: 1px solid #e8edf6;
|
||
border-radius: 10px;
|
||
padding: 16px;
|
||
text-align: center;
|
||
}
|
||
.sp-num {
|
||
font-size: 34px;
|
||
font-weight: 800;
|
||
color: #1d6fe0;
|
||
font-variant-numeric: tabular-nums;
|
||
line-height: 1.2;
|
||
&.up {
|
||
color: #0d9f57;
|
||
}
|
||
&.ms {
|
||
color: #7c3aed;
|
||
}
|
||
}
|
||
.sp-unit {
|
||
font-size: 14.5px;
|
||
color: #5b6b85;
|
||
margin-top: 2px;
|
||
}
|
||
.sp-grade {
|
||
margin-top: 8px;
|
||
font-size: 15px;
|
||
color: #33415c;
|
||
min-height: 22px;
|
||
}
|
||
.sp-item.tip {
|
||
text-align: left;
|
||
}
|
||
.sp-tip-t {
|
||
font-size: 15px;
|
||
font-weight: 700;
|
||
color: #33415c;
|
||
margin-bottom: 6px;
|
||
}
|
||
.sp-tip {
|
||
font-size: 14.5px;
|
||
color: #5b6b85;
|
||
line-height: 1.6;
|
||
}
|
||
.sp-error {
|
||
color: #dc2626;
|
||
font-size: 15px;
|
||
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;
|
||
border: 1px solid var(--n-border, rgba(128, 128, 128, 0.25));
|
||
border-radius: 10px;
|
||
padding: 10px 14px 12px;
|
||
background: rgba(128, 128, 128, 0.05);
|
||
}
|
||
|
||
.sp-hist-head {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 8px;
|
||
margin-bottom: 8px;
|
||
flex-wrap: wrap;
|
||
|
||
.sp-hist-t {
|
||
font-size: 14px;
|
||
font-weight: 600;
|
||
}
|
||
}
|
||
|
||
.sp-hist-table {
|
||
font-size: 13.5px;
|
||
|
||
.sp-hrow {
|
||
display: grid;
|
||
grid-template-columns: 1.1fr 1.1fr 1fr 1fr 0.9fr 2.4fr;
|
||
gap: 6px;
|
||
padding: 6px 4px;
|
||
align-items: center;
|
||
border-bottom: 1px dashed rgba(128, 128, 128, 0.2);
|
||
|
||
&:last-child {
|
||
border-bottom: none;
|
||
}
|
||
|
||
&.sp-hhead {
|
||
font-weight: 600;
|
||
opacity: 0.75;
|
||
font-size: 12.5px;
|
||
border-bottom: 1px solid rgba(128, 128, 128, 0.3);
|
||
}
|
||
|
||
.c-down {
|
||
color: #18a058;
|
||
font-weight: 600;
|
||
font-variant-numeric: tabular-nums;
|
||
}
|
||
|
||
.c-up {
|
||
color: #2080f0;
|
||
font-weight: 600;
|
||
font-variant-numeric: tabular-nums;
|
||
}
|
||
|
||
.c-ms {
|
||
font-variant-numeric: tabular-nums;
|
||
}
|
||
}
|
||
}
|
||
|
||
.tag-v4,
|
||
.tag-v6 {
|
||
font-style: normal;
|
||
font-size: 12px;
|
||
padding: 1px 8px;
|
||
border-radius: 999px;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.tag-v4 {
|
||
background: rgba(32, 128, 240, 0.14);
|
||
color: #2080f0;
|
||
}
|
||
|
||
.tag-v6 {
|
||
background: rgba(24, 165, 88, 0.15);
|
||
color: #18a058;
|
||
}
|
||
|
||
.sp-hist-tip {
|
||
margin-top: 8px;
|
||
font-size: 12.5px;
|
||
opacity: 0.7;
|
||
line-height: 1.6;
|
||
}
|
||
|
||
@media (max-width: 900px) {
|
||
.sec-head {
|
||
h3 {
|
||
width: 100%;
|
||
}
|
||
}
|
||
.sp-hist-table .sp-hrow {
|
||
grid-template-columns: 0.9fr 1fr 0.8fr 0.8fr 0.7fr 2.6fr;
|
||
font-size: 12.5px;
|
||
}
|
||
|
||
.sp-hist-table .c-lat {
|
||
font-family: monospace;
|
||
font-size: 11.5px;
|
||
opacity: 0.85;
|
||
line-height: 1.6;
|
||
word-break: break-all;
|
||
}
|
||
}
|
||
</style>
|