Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #238

Merged
merged 5 commits into from
Sep 17, 2024
Merged

Dev #238

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@ If you're using a proxy for internet access, consider adding this rule to your p

```ini
# IP Testing
IP-CIDR,1.0.0.1/32,DIRECT,no-resolve
IP-CIDR6,2606:4700:4700::1111/128,DIRECT,no-resolve
DOMAIN-SUFFIX,ipify.org,Proxy
IP-CIDR,1.0.0.1/32,Proxy,no-resolve
IP-CIDR6,2606:4700:4700::1111/128,Proxy,no-resolve
DOMAIN,4.ipcheck.ing,DIRECT
DOMAIN,6.ipcheck.ing,DIRECT
# Rule Testing
DOMAIN,ptest-1.ipcheck.ing,Proxy1
DOMAIN,ptest-2.ipcheck.ing,Proxy2
Expand Down
6 changes: 4 additions & 2 deletions README_FR.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,10 @@ Si vous utilisez un proxy pour accéder à Internet, envisagez d'ajouter cette r

```ini
# Test d'adresse IP
IP-CIDR,1.0.0.1/32,DIRECT,no-resolve
IP-CIDR6,2606:4700:4700::1111/128,DIRECT,no-resolve
IP-CIDR,1.0.0.1/32,Proxy,no-resolve
IP-CIDR6,2606:4700:4700::1111/128,Proxy,no-resolve
DOMAIN,4.ipcheck.ing,DIRECT
DOMAIN,6.ipcheck.ing,DIRECT
# Rule Testing
DOMAIN,ptest-1.ipcheck.ing,Proxy1
DOMAIN,ptest-2.ipcheck.ing,Proxy2
Expand Down
7 changes: 4 additions & 3 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@ docker run -d -p 18966:18966 \

```ini
# IP Testing
IP-CIDR,1.0.0.1/32,DIRECT,no-resolve
IP-CIDR6,2606:4700:4700::1111/128,DIRECT,no-resolve
DOMAIN-SUFFIX,ipify.org,Proxy
IP-CIDR,1.0.0.1/32,Proxy,no-resolve
IP-CIDR6,2606:4700:4700::1111/128,Proxy,no-resolve
DOMAIN,4.ipcheck.ing,DIRECT
DOMAIN,6.ipcheck.ing,DIRECT
# Rule Testing
DOMAIN,ptest-1.ipcheck.ing,Proxy1
DOMAIN,ptest-2.ipcheck.ing,Proxy2
Expand Down
46 changes: 23 additions & 23 deletions frontend/components/IpInfos.vue
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ import { useI18n } from 'vue-i18n';
import { trackEvent } from '@/utils/use-analytics';
import { isValidIP } from '@/utils/valid-ip.js';
import { transformDataFromIPapi } from '@/utils/transform-ip-data.js';
import { getIPFromIPIP, getIPFromUpai, getIPFromCloudflare_V4, getIPFromCloudflare_V6, getIPFromGCR, getIPFromIpify_V4, getIPFromIpify_V6 } from '@/utils/getips';
import { getIPFromIPIP, getIPFromCloudflare_V4, getIPFromCloudflare_V6, getIPFromIPChecking64, getIPFromIPChecking4, getIPFromIPChecking6 } from '@/utils/getips';


const { t } = useI18n();
Expand Down Expand Up @@ -247,11 +247,6 @@ const ipDataCards = reactive([
id: "cnsource",
source: "CN Source",
},
{
...createDefaultCard(),
id: "special",
source: "Special",
},
{
...createDefaultCard(),
id: "cloudflare_v4",
Expand All @@ -264,20 +259,25 @@ const ipDataCards = reactive([
},
{
...createDefaultCard(),
id: "ipify_v4",
source: "IPify IPv4",
id: "ipchecking_v64",
source: "IPCheck.ing IPv6/4",
},
{
...createDefaultCard(),
id: "ipify_v6",
source: "IPify IPv6",
id: "ipchecking_v4",
source: "IPCheck.ing IPv4",
},
{
...createDefaultCard(),
id: "ipchecking_v6",
source: "IPCheck.ing IPv6",
},
]);

// 默认 ASN 信息
const asnInfos = ref({
"AS15169": {
"asnName": "Google", "asnOrgName": "GOGL-ARIN", "estimatedUsers": "368891", "IPv4_Pct": "95.35", "IPv6_Pct": "4.65", "HTTP_Pct": "3.16", "HTTPS_Pct": "96.84", "Desktop_Pct": "58.88", "Mobile_Pct": "41.12", "Bot_Pct": "98.46", "Human_Pct": "1.54"
"AS888888": {
"asnName": "Google", "asnOrgName": "GOGL-ARIN", "estimatedUsers": "888888", "IPv4_Pct": "95.35", "IPv6_Pct": "4.65", "HTTP_Pct": "3.16", "HTTPS_Pct": "96.84", "Desktop_Pct": "58.88", "Mobile_Pct": "41.12", "Bot_Pct": "98.46", "Human_Pct": "1.54"
}
});

Expand Down Expand Up @@ -332,11 +332,11 @@ const trackFetchStatus = (status) => {
const checkAllIPs = async () => {
const ipFunctions = [
() => fetchIP(0, getIPFromIPIP),
() => fetchIP(1, configs.value.originalSite ? getIPFromGCR : getIPFromUpai),
() => fetchIP(2, getIPFromCloudflare_V4),
() => fetchIP(3, getIPFromCloudflare_V6),
() => fetchIP(4, getIPFromIpify_V4),
() => fetchIP(5, getIPFromIpify_V6),
() => fetchIP(1, getIPFromCloudflare_V4),
() => fetchIP(2, getIPFromCloudflare_V6),
() => fetchIP(3, getIPFromIPChecking64),
() => fetchIP(4, getIPFromIPChecking4),
() => fetchIP(5, getIPFromIPChecking6),
];

// 限制执行的函数数量为 ipCardsToShow 的长度
Expand Down Expand Up @@ -463,19 +463,19 @@ const refreshCard = (card, index) => {
fetchIP(0, getIPFromIPIP);
break;
case 1:
fetchIP(1, configs.value.originalSite ? getIPFromGCR : getIPFromUpai);
fetchIP(1, getIPFromCloudflare_V4);
break;
case 2:
fetchIP(2, getIPFromCloudflare_V4);
fetchIP(2, getIPFromCloudflare_V6);
break;
case 3:
fetchIP(3, getIPFromCloudflare_V6);
break;
fetchIP(3, getIPFromIPChecking64);
break;
case 4:
fetchIP(4, getIPFromIpify_V4);
fetchIP(4, getIPFromIPChecking4);
break;
case 5:
fetchIP(5, getIPFromIpify_V6);
fetchIP(5, getIPFromIPChecking6);
break;
default:
console.error("Undefind Source:");
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/widgets/Preferences.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<i class="bi bi-ui-checks-grid"></i> {{ t('nav.preferences.ipSourcesToCheck') }}
</div>
<div class="btn-group col-auto w-50 mb-2" role="group" aria-label="ipCards">
<template v-for="num in [2, 3, 6]">
<template v-for="num in [3, 6]">
<input v-model="userPreferences.ipCardsToShow" type="radio" class="btn-check"
:name="'ipCards_' + num" :id="'ipCards_' + num" autocomplete="off" :value=num
@change="prefipCards(num)">
Expand Down
2 changes: 1 addition & 1 deletion frontend/style/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
}

.jn-list-group-item {
border-bottom: 1px solid rgb(222, 226, 230);
border-bottom: 1px dashed rgb(222, 226, 230);
padding: 12px 4px 12px 4px;
display: flex;
margin: 0;
Expand Down
1 change: 1 addition & 0 deletions frontend/utils/getips/cloudflare-v6.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const getIPFromCloudflare_V6 = async () => {
};
}
} catch (error) {
console.error("Error fetching IP from Cloudflare:", error);
return {
ip: null,
source: "Cloudflare IPv6"
Expand Down
11 changes: 4 additions & 7 deletions frontend/utils/getips/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { getIPFromIPIP } from "./ipipnet";
import { getIPFromQQ } from "./qq";
import { getIPFromUpai } from "./upai";
import { getIPFromCloudflare_CN } from "./cloudflare-cn";
import { getIPFromCloudflare_V4 } from "./cloudflare-v4";
import { getIPFromCloudflare_V6 } from "./cloudflare-v6";
import { getIPFromGCR } from "./ipchecking";
import { getIPFromIpify_V4 } from "./ipify-v4";
import { getIPFromIpify_V6 } from "./ipify-v6";
import { getIPFromIPChecking64 } from "./ipchecking64";
import { getIPFromIPChecking4 } from "./ipchecking4";
import { getIPFromIPChecking6 } from "./ipchecking6";

export { getIPFromIPIP, getIPFromQQ, getIPFromUpai, getIPFromCloudflare_CN, getIPFromCloudflare_V4, getIPFromCloudflare_V6, getIPFromGCR, getIPFromIpify_V4, getIPFromIpify_V6};
export { getIPFromIPIP, getIPFromCloudflare_V4, getIPFromCloudflare_V6, getIPFromIPChecking64, getIPFromIPChecking4, getIPFromIPChecking6};
36 changes: 36 additions & 0 deletions frontend/utils/getips/ipchecking4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { isValidIP } from '@/utils/valid-ip.js';

// 从 IPCheck.ing 获取 IPv4 地址
const getIPFromIPChecking4 = async () => {
try {
const response = await fetch("https://4.ipcheck.ing/cdn-cgi/trace");
const data = await response.text();
const lines = data.split("\n");
const ipLine = lines.find((line) => line.startsWith("ip="));
let ip = "";
if (ipLine) {
ip = ipLine.split("=")[1];
}
const source = "IPCheck.ing IPv4";
if (isValidIP(ip)) {
return {
ip: ip,
source: source
};
} else {
console.error("Invalid IP from IPCheck.ing IPv4:", ip);
return {
ip: null,
source: source
};
}
} catch (error) {
console.error("Error fetching IP from IPCheck.ing IPv4:", error);
return {
ip: null,
source: "IPCheck.ing IPv4"
};
}
};

export { getIPFromIPChecking4 };
36 changes: 36 additions & 0 deletions frontend/utils/getips/ipchecking6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { isValidIP } from '@/utils/valid-ip.js';

// 从 IPCheck.ing 获取 IPv6 地址
const getIPFromIPChecking6 = async () => {
try {
const response = await fetch("https://6.ipcheck.ing/cdn-cgi/trace");
const data = await response.text();
const lines = data.split("\n");
const ipLine = lines.find((line) => line.startsWith("ip="));
let ip = "";
if (ipLine) {
ip = ipLine.split("=")[1];
}
const source = "IPCheck.ing IPv6";
if (isValidIP(ip)) {
return {
ip: ip,
source: source
};
} else {
console.error("Invalid IP from IPCheck.ing IPv6:", ip);
return {
ip: null,
source: source
};
}
} catch (error) {
console.error("Error fetching IP from IPCheck.ing IPv6:", error);
return {
ip: null,
source: "IPCheck.ing IPv6"
};
}
};

export { getIPFromIPChecking6 };
36 changes: 36 additions & 0 deletions frontend/utils/getips/ipchecking64.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { isValidIP } from '@/utils/valid-ip.js';

// 从 IPCheck.ing 获取 IPv6 地址
const getIPFromIPChecking64 = async () => {
try {
const response = await fetch("https://64.ipcheck.ing/cdn-cgi/trace");
const data = await response.text();
const lines = data.split("\n");
const ipLine = lines.find((line) => line.startsWith("ip="));
let ip = "";
if (ipLine) {
ip = ipLine.split("=")[1];
}
const source = "IPCheck.ing IPv6/4";
if (isValidIP(ip)) {
return {
ip: ip,
source: source
};
} else {
console.error("Invalid IP from IPCheck.ing IPv6/4:", ip);
return {
ip: null,
source: source
};
}
} catch (error) {
console.error("Error fetching IP from IPCheck.ing IPv6/4:", error);
return {
ip: null,
source: "IPCheck.ing IPv6/4"
};
}
};

export { getIPFromIPChecking64 };
5 changes: 2 additions & 3 deletions frontend/utils/getips/ipipnet.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// import { getIPFromQQ } from "./qqvideo";
import { getIPFromAliCDN } from "./alicdn";
import { getIPFromUpai } from "./upai";
import { isValidIP } from '@/utils/valid-ip.js';

// 从 IPIP.net 获取 IP 地址
Expand All @@ -21,7 +20,7 @@ const getIPFromIPIP = async () => {
console.error("Error fetching IP from IPIP.net:", error);
}
// 故障时尝试从 AliCDN 获取 IP 地址
const { ip, source } = await getIPFromAliCDN();
const { ip, source } = await getIPFromUpai();
return {
ip: ip,
source: source
Expand Down
2 changes: 1 addition & 1 deletion frontend/utils/masked-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function maskedInfo(t) {
fakecard.latitude = "37.40599";
fakecard.longitude = "-122.078514";
fakecard.isp = "Google LLC";
fakecard.asn = "AS15169";
fakecard.asn = "AS888888";
fakecard.asnlink = "https://radar.cloudflare.com/AS15169",
fakecard.mapUrl = '/res/defaultMap.webp';
fakecard.mapUrl_dark = '/res/defaultMap_dark.webp';
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"bootstrap": "^5.3.3",
"bootstrap-icons": "^1.11.3",
"code-inspector-plugin": "^0.16.1",
"concurrently": "^9.0.0",
"concurrently": "^9.0.1",
"country-code-lookup": "^0.1.3",
"dotenv": "^16.4.5",
"express": "^4.19.2",
"express": "^4.21.0",
"express-rate-limit": "^7.4.0",
"express-slow-down": "^2.0.3",
"flag-icons": "^7.2.3",
Expand All @@ -31,14 +31,14 @@
"nodemon": "^3.1.4",
"pinia": "^2.2.2",
"svgmap": "^2.11.1",
"vue": "^3.5.3",
"vue-i18n": "^9.14.0",
"vue-router": "^4.4.3",
"vue": "^3.5.6",
"vue-i18n": "^10.0.1",
"vue-router": "^4.4.5",
"whoiser": "^1.18.0"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.1.3",
"vite": "^5.4.3",
"vite": "^5.4.6",
"vite-plugin-pwa": "^0.20.5"
}
}