mirror of
https://github.com/fosrl/pangolin.git
synced 2026-08-05 20:21:19 +02:00
delete the client peers from the exit nodes properly
This commit is contained in:
@@ -93,6 +93,9 @@ export async function deleteOrgById(
|
|||||||
await trx.delete(sites).where(eq(sites.siteId, site.siteId));
|
await trx.delete(sites).where(eq(sites.siteId, site.siteId));
|
||||||
}
|
}
|
||||||
for (const client of orgClients) {
|
for (const client of orgClients) {
|
||||||
|
if (client.exitNodeId && client.pubKey) {
|
||||||
|
await deletePeer(client.exitNodeId, client.pubKey);
|
||||||
|
}
|
||||||
const [olm] = await trx
|
const [olm] = await trx
|
||||||
.select()
|
.select()
|
||||||
.from(olms)
|
.from(olms)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import {
|
|||||||
verifyExitNodeOrgAccess
|
verifyExitNodeOrgAccess
|
||||||
} from "#dynamic/lib/exitNodes";
|
} from "#dynamic/lib/exitNodes";
|
||||||
import { getUniqueSubnetForExitNode } from "@server/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_THRESHOLD = 18;
|
||||||
const HOLEPUNCH_STALE_CHAIN_TTL_SECONDS = 1800;
|
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) {
|
if (clientSubnet && exitNodeId) {
|
||||||
try {
|
try {
|
||||||
// add the peer to the exit node so it can connect
|
// add the peer to the exit node so it can connect
|
||||||
|
|||||||
Reference in New Issue
Block a user