@samitouri / QOSami-HFS / commits / 7b2dbdc0

removed legacy services

Massimo Melina committed Nov 7, 2024 at 23:23 UTC 7b2dbdc0d52980908f2b2a7daac2502efe1a77dd
2 files changed +7 -29
central.json
+5 -28
@@ -1,26 +1,11 @@
1 {
2 "dnsServers": ["1.1.1.1", "8.8.8.8"],
3 - "checkServerServices": [
4 - {
5 - "url": "https://ports.yougetsignal.com/check-port.php",
6 - "headers": {"content-type": "application/x-www-form-urlencoded"},
7 - "method": "post",
8 - "body": "remoteAddress=$IP&portNumber=$PORT",
9 - "regexpFailure": "is closed",
10 - "regexpSuccess": "is open"
11 - },
12 - {
13 - "url": "https://canyouseeme.org",
14 - "headers": {"content-type": "application/x-www-form-urlencoded"},
15 - "method": "post",
16 - "body": "port=$PORT",
17 - "regexpFailure": "Error:",
18 - "regexpSuccess": "Success:"
19 - },
3 + "selfCheckServices": [
4 {
21 - "url": "http://ifconfig.co/port/$PORT?ip=$IP",
22 - "regexpFailure": "reachable\": false",
23 - "regexpSuccess": "reachable\": true"
5 + "url": "http://hfstest.rejetto.com/v3?url=$URL",
6 + "headers": {"User-Agent": "HFS"},
7 + "regexpFailure": "\"error\"",
8 + "regexpSuccess": "\"good\""
9 }
10 ],
11 "selfCheckServices_disabled": [
@@ -35,14 +20,6 @@
20 "regexpSuccess": "true"
21 }
22 ],
38 - "selfCheckServices": [
39 - {
40 - "url": "http://hfstest.rejetto.com/v3?url=$URL",
41 - "headers": {"User-Agent": "HFS"},
42 - "regexpFailure": "\"error\"",
43 - "regexpSuccess": "\"good\""
44 - }
45 - ],
23 "publicIpServices": [
24 "http://ipv4.icanhazip.com",
25 { "v": 6, "type": "http", "url": "http://ipv6.icanhazip.com" },
src/selfCheck.ts
+2 -1
@@ -40,11 +40,12 @@ export async function selfCheck(url: string) {
40 selfChecking = true
41 for (const services of _.chunk(_.shuffle<PortScannerService>(prjInfo.selfCheckServices), 2)) {
42 try {
43 - return await Promise.any(services.map(async (svc) => {
43 + return await Promise.any(services.map(async svc => {
44 if (!svc.url || svc.type) throw 'unsupported ' + svc.type // only default type supported for now
45 let { url: serviceUrl, body, regexpSuccess, regexpFailure, ...rest } = svc
46 const service = new URL(serviceUrl).hostname
47 console.log('trying external service', service)
48 + console.debug(svc)
49 body = applySymbols(body)
50 serviceUrl = applySymbols(serviceUrl)!
51 const res = await haveTimeout(6_000, httpString(serviceUrl, { family, ...rest, body }))