Handle updating exit node and fix raw resource issues

This commit is contained in:
Owen
2025-10-16 13:55:08 -07:00
parent 46807c6477
commit ec7211a15d
4 changed files with 6 additions and 53 deletions

View File

@@ -69,6 +69,7 @@ export async function createExitNode(
})
.where(eq(exitNodes.exitNodeId, exitNodeQuery.exitNodeId))
.returning();
logger.info(`Updated exit node reachableAt to ${reachableAt}`);
}
return exitNode;

View File

@@ -52,7 +52,7 @@ export async function createExitNode(publicKey: string, reachableAt: string | un
.where(eq(exitNodes.publicKey, publicKey))
.returning();
logger.info(`Updated exit node`);
logger.info(`Updated exit node with reachableAt to ${reachableAt}`);
}
return exitNode;

View File

@@ -117,27 +117,4 @@ export async function generateGerbilConfig(exitNode: ExitNode) {
};
return configResponse;
}
async function getNextAvailablePort(): Promise<number> {
// Get all existing ports from exitNodes table
const existingPorts = await db
.select({
listenPort: exitNodes.listenPort
})
.from(exitNodes);
// Find the first available port between 1024 and 65535
let nextPort = config.getRawConfig().gerbil.start_port;
for (const port of existingPorts) {
if (port.listenPort > nextPort) {
break;
}
nextPort++;
if (nextPort > 65535) {
throw new Error("No available ports remaining in space");
}
}
return nextPort;
}
}