update 2026-07-13 00:53:40

This commit is contained in:
action committed 2026-07-13 00:53:40 +08:00
1 parent 192d5e4fd9
commit dc61ff94d8
41 files changed
+750 -549

No files matched your search

@@ -773,10 +773,10 @@ function parse_uri(uri) {
/* Unsupported protocol */
if (params.type === 'kcp') {
log(sprintf('Skipping sunsupported %s node: %s.', uri[0], urldecode(url.hash) || url.hostname));
log(sprintf('Skipping unsupported %s node: %s.', uri[0], urldecode(url.hash) || url.hostname));
return null;
} else if (params.type === 'quic' && ((params.quicSecurity && params.quicSecurity !== 'none') || !sing_features.with_quic)) {
log(sprintf('Skipping sunsupported %s node: %s.', uri[0], urldecode(url.hash) || url.hostname));
log(sprintf('Skipping unsupported %s node: %s.', uri[0], urldecode(url.hash) || url.hostname));
if (!sing_features.with_quic)
log(sprintf('Please rebuild sing-box with %s support!', 'QUIC'));
@@ -169,7 +169,7 @@ const methods = {
push(commands, sprintf(
'/usr/bin/curl --location --silent --output /dev/null --user-agent %s --connect-timeout 5 --max-time 9 --write-out %s %s',
shellquote('Mozilla/5.0'),
shellquote(sprintf('%s\\t%%{http_code}\\t%%{time_total}\\n', site)),
shellquote(sprintf('%s\\t%%{http_code}\\t%%{time_appconnect}\\t%%{time_total}\\n', site)),
shellquote(CONNECTION_SITES[site])
));
}
@@ -188,20 +188,25 @@ const methods = {
fd.close();
const responses = {};
const curlTimeMs = (value) => {
const parts = split(value || '0', '.');
const fraction = ((parts[1] || '') + '000');
return int(parts[0] || '0') * 1000 + int(substr(fraction, 0, 3));
};
for (let response in split(trim(payload), /[\r\n]+/)) {
const fields = split(response, '\t');
if (length(fields) !== 3 || !CONNECTION_SITES[fields[0]])
if (length(fields) !== 4 || !CONNECTION_SITES[fields[0]])
continue;
const time_parts = split(fields[2], '.');
const fraction = ((time_parts[1] || '') + '000');
const latency_ms = int(time_parts[0] || '0') * 1000 + int(substr(fraction, 0, 3));
const latency_ms = curlTimeMs(fields[2]);
const total_ms = curlTimeMs(fields[3]);
const http_code = int(fields[1] || '0');
responses[fields[0]] = {
site: fields[0],
result: http_code >= 100 && http_code <= 599,
latency_ms,
timed_out: http_code === 0 && latency_ms >= 8900
timed_out: http_code === 0 && total_ms >= 8900
};
}