delete the client peers from the exit nodes properly

This commit is contained in:
Owen
2026-08-04 15:45:44 -04:00
parent ec5a2b0cbe
commit 2cfd7e867b
2 changed files with 10 additions and 1 deletions
+3
View File
@@ -93,6 +93,9 @@ export async function deleteOrgById(
await trx.delete(sites).where(eq(sites.siteId, site.siteId));
}
for (const client of orgClients) {
if (client.exitNodeId && client.pubKey) {
await deletePeer(client.exitNodeId, client.pubKey);
}
const [olm] = await trx
.select()
.from(olms)
@@ -28,7 +28,7 @@ import {
verifyExitNodeOrgAccess
} from "#dynamic/lib/exitNodes";
import { getUniqueSubnetForExitNode } from "@server/lib/exitNodes";
import { addPeer } from "../gerbil/peers";
import { addPeer, deletePeer } from "../gerbil/peers";
const HOLEPUNCH_STALE_CHAIN_THRESHOLD = 18;
const HOLEPUNCH_STALE_CHAIN_TTL_SECONDS = 1800;
@@ -394,6 +394,12 @@ export const handleOlmRegisterMessage: MessageHandler = async (context) => {
);
}
if (client.pubKey && client.pubKey !== publicKey && client.exitNodeId) {
// test the old client to see if its different then remove
logger.info("Public key mismatch. Deleting old peer...");
await deletePeer(client.exitNodeId, client.pubKey);
}
if (clientSubnet && exitNodeId) {
try {
// add the peer to the exit node so it can connect