Move exit node function

This commit is contained in:
Owen 2025-08-15 15:52:09 -07:00
parent 5c94887949
commit 21ce678e5b
No known key found for this signature in database
GPG key ID: 8271FDFFD9E0CCBD
2 changed files with 14 additions and 13 deletions

View file

@ -1,5 +1,6 @@
import { db, exitNodes } from "@server/db";
import logger from "@server/logger";
import { ExitNodePingResult } from "@server/routers/newt";
import { eq, and, or } from "drizzle-orm";
export async function verifyExitNodeOrgAccess(
@ -41,3 +42,14 @@ export async function listExitNodes(orgId: string, filterOnline = false) {
return allExitNodes;
}
export function selectBestExitNode(
pingResults: ExitNodePingResult[]
): ExitNodePingResult | null {
if (!pingResults || pingResults.length === 0) {
logger.warn("No ping results provided");
return null;
}
return pingResults[0];
}