fix(cluster): trust non-bridge ip_address from heartbeat payload

This commit is contained in:
OpenCode 2026-06-04 22:09:10 +00:00
parent 6c1edae7f0
commit ec58556c36

View file

@ -43,9 +43,10 @@ function pickIp(reportedIp, reqIp) {
const clean = (s) => (s || '').replace(/^::ffff:/, '');
const isDockerBridge = (ip) => /^172\.17\./.test(ip || '');
const r = clean(reqIp);
if (!reportedIp) return r || null;
if (isDockerBridge(reportedIp) && r && !isDockerBridge(r)) return r;
return reportedIp;
// Trust payload ip_address when present and not docker0 bridge
if (reportedIp && !isDockerBridge(reportedIp)) return reportedIp;
// Fall back to req.ip when payload missing or docker0
return r || null;
}
function dockerRequest(path, method = 'GET', body = null) {