@samitouri / QOSami-HFS / commits / f345ca47

fix: checking ipv6 with ifconfig.co was not working

Massimo Melina committed Oct 1, 2023 at 23:45 UTC f345ca47e15cf2f53d71f0c83fb0dd2ddb6ee532
1 file changed +1 -1
src/api.net.ts
+1 -1
@@ -190,7 +190,7 @@ async function checkPort(ip: string, port: number) {
190 return Promise.any(services.map(async ({ url, body, selector, regexpSuccess, regexpFailure, ...rest }) => {
191 const service = new URL(url).hostname
192 console.log('trying service', service)
193 - const res = await httpString(applySymbols(url)!, { ...rest, body: applySymbols(body) })
193 + const res = await httpString(applySymbols(url)!, { family: isIPv6(ip) ? 6 : 4, body: applySymbols(body), ...rest })
194 const success = new RegExp(regexpSuccess).test(res)
195 const failure = new RegExp(regexpFailure).test(res)
196 if (success === failure) throw console.debug('inconsistent:' + service) // this result cannot be trusted