This commit is contained in:
Raven Scott
2026-05-27 19:59:45 -04:00
parent 229350e066
commit dbc6997219
8 changed files with 46 additions and 20 deletions
@@ -58,7 +58,7 @@ async function handleStatusRoutes(req, res) {
const query = url.parse(req.url, true).query;
const probeType = query.probe || 'liveness';
const dnsHealthy = !!state.dnsPass && state.dnsPass.ready;
const dnsHealthy = !!state.dnsPass && state.dnsPass.opened !== false;
const proxyHealthy = process.env.DISABLE_PROXY_SERVER !== 'true';
const swarmHealthy = state.connectedPeers !== undefined;
@@ -82,7 +82,7 @@ async function handleStatusRoutes(req, res) {
healthy: dnsHealthy,
initialized: !!state.dnsPass,
details: {
passReady: !!state.dnsPass?.ready,
passReady: state.dnsPass?.opened !== false,
domainsCount: state.domainToIPMap?.size || 0
}
},
+1 -1
View File
@@ -214,7 +214,7 @@ function broadcastHealth() {
if (adminClients.size === 0) return;
try {
const dnsHealthy = !!state.dnsPass && state.dnsPass.ready;
const dnsHealthy = !!state.dnsPass && state.dnsPass.opened !== false;
const proxyHealthy = process.env.DISABLE_PROXY_SERVER !== 'true';
const swarmHealthy = state.connectedPeers !== undefined;
const corestoreHealthy = state.dnsPass && state.dnsPass.base && state.dnsPass.base.writable !== undefined;
+2 -2
View File
@@ -57,7 +57,7 @@ async function handleStatusRoutes(req, res) {
const query = url.parse(req.url, true).query;
const probeType = query.probe || 'liveness';
const dnsHealthy = !!state.dnsPass && state.dnsPass.ready;
const dnsHealthy = !!state.dnsPass && state.dnsPass.opened !== false;
const proxyHealthy = process.env.DISABLE_PROXY_SERVER !== 'true';
const swarmHealthy = state.connectedPeers !== undefined;
@@ -81,7 +81,7 @@ async function handleStatusRoutes(req, res) {
healthy: dnsHealthy,
initialized: !!state.dnsPass,
details: {
passReady: !!state.dnsPass?.ready,
passReady: state.dnsPass?.opened !== false,
domainsCount: state.domainToIPMap?.size || 0
}
},
+1 -1
View File
@@ -60,10 +60,10 @@ const countedTies = new Set(); // Set of tie keys: "domain:claimant"
function isDnsPassUsable(pass) {
if (!pass) return false;
if (pass.closed) return false;
if (pass.opened === false) return false;
const base = pass.base;
if (!base) return false;
if (base.closed || base.closing) return false;
if (!pass.ready) return false;
return true;
}
+14
View File
@@ -0,0 +1,14 @@
/**
* Resolve whether this process is the Autopass master (invite authority).
* Docker/PM2 often omit argv flags; P2NS_MASTER=true is supported as an alternative to --master.
* @returns {boolean}
*/
function resolveIsMaster() {
if (process.argv.includes('--master')) return true;
const v = process.env.P2NS_MASTER ?? process.env.MASTER;
if (v === undefined || v === '') return false;
const normalized = String(v).trim().toLowerCase();
return normalized === '1' || normalized === 'true' || normalized === 'yes';
}
module.exports = { resolveIsMaster };
+1 -1
View File
@@ -68,7 +68,7 @@ module.exports = {
holesailStartTimes: new Map(), // Track when each p2p-domain holesail connection was started
persistentConnections: new Set(), // Track which connections are persistent
localDnsRecords: [],
isMaster: process.argv.includes('--master'),
isMaster: require('./master-mode').resolveIsMaster(),
sendRemovalRequest: null,
sendConsensusRequest: null,
domainsWithBoth: new Set(),