less breaking approach
Massimo Melina committed
Oct 1, 2023 at 23:49 UTC
bcff1d7709df547a92bc7dc5fa0d2b0f409543c8
2 files changed
+7
-8
central.json
+3
-7
@@ -18,16 +18,14 @@
18
"regexpSuccess": "Success:"
19
},
20
{
21
- "url": "https://ifconfig.co/port/$PORT",
21
+ "url": "http://ifconfig.co/port/$PORT?ip=$IP",
22
"regexpFailure": "reachable\": false",
23
"regexpSuccess": "reachable\": true"
24
}
25
],
26
"publicIpServices": [
27
- "http://checkip.amazonaws.com",
28
- "http://ipinfo.io/ip"
29
- ],
30
- "publicIpServices_049": [
27
+ "http://ipv4.icanhazip.com",
28
+ { "v": 6, "type": "http", "url": "http://ipv6.icanhazip.com" },
29
{
30
"v": 4, "type": "dns",
31
"ips": ["208.67.222.222", "208.67.220.220"],
@@ -38,8 +36,6 @@
36
"ips": ["216.239.32.10", "216.239.34.10", "216.239.36.10", "216.239.38.10"],
37
"name": "o-o.myaddr.l.google.com", "dnsRecord": "TXT"
38
},
41
- { "v": 4, "type": "http", "url": "http://ipv4.icanhazip.com" },
42
- { "v": 6, "type": "http", "url": "http://ipv6.icanhazip.com" },
39
{
40
"v": 6, "type": "dns",
41
"ips": ["2620:0:ccc::2", "2620:0:ccd::2"],
src/api.net.ts
+4
-1
@@ -57,9 +57,12 @@ const getNatInfo = debounceAsync(async () => {
57
58
async function getPublicIps() {
59
const res = await getProjectInfo()
60
- const groupedByVersion = Object.values(_.groupBy(res.publicIpServices_049, x => x.v))
60
+ const groupedByVersion = Object.values(_.groupBy(res.publicIpServices, x => x.v ?? 4))
61
const ips = await promiseBestEffort(groupedByVersion.map(singleVersion =>
62
Promise.any(singleVersion.map(async (svc: any) => {
63
+ if (typeof svc === 'string')
64
+ svc = { type: 'http', url: svc }
65
+ console.debug("trying ip service", svc.url || svc.name)
66
if (svc.type === 'http')
67
return httpString(svc.url)
68
if (svc.type !== 'dns') throw "unsupported"