Modernize Holepunch stack for HyperDB 6 and current replication APIs

Align P2NS with current Autopass, Hypercore, Hyperdrive, and Protomux behavior:
add plugin DB recovery for incompatible persisted HyperDB data, stop
unconditional spec rebuilds via fingerprinting, update SDK replication paths,
and align proxy invite channels with p2ns.core-* protocols without replicating
Autopass over the p2ns topic.
This commit is contained in:
Raven Scott
2026-05-27 21:02:17 -04:00
parent 7cd98231f7
commit d57433d3e0
19 changed files with 630 additions and 405 deletions
+7 -10
View File
@@ -723,17 +723,13 @@ async function setupP2NS() {
// Configure Hyperswarm for better local network peer discovery
const swarmOptions = {
keyPair: state.keypair,
ephemeral: false,
maxPeers: parseInt(process.env.MAX_PEERS || '24', 10),
queue: {
multiplex: true
}
maxPeers: parseInt(process.env.MAX_PEERS || '24', 10)
};
const swarm = new Hyperswarm(swarmOptions);
state.swarm = swarm;
logInfo('Main', 'Hyperswarm instance created with persisted keypair');
logInfo('Main', `Hyperswarm configured: maxPeers=${swarmOptions.maxPeers}, ephemeral=${swarmOptions.ephemeral}`);
logInfo('Main', `Hyperswarm configured: maxPeers=${swarmOptions.maxPeers}`);
let dnsPass = null;
let core = null;
@@ -773,11 +769,12 @@ async function setupP2NS() {
}
state.connectedPeers.add(peerId);
store.replicate(conn, { live: true });
// Do not replicate the full Corestore on the p2ns topic — Autopass uses its own pairing/replication.
logDebug('Swarm', 'Skipping p2ns-topic Corestore replication (Autopass handles dnsPass sync)');
const mux = Protomux.from(conn);
const inviteChannel = mux.createChannel({ protocol: 'p2ns-invite' });
const requestChannel = mux.createChannel({ protocol: 'p2ns-request' });
const inviteChannel = mux.createChannel({ protocol: 'p2ns.core-invite' });
const requestChannel = mux.createChannel({ protocol: 'p2ns.core-request' });
const inviteMessage = inviteChannel.addMessage({
encoding: c.string,