mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-20 09:19:02 +02:00
Move exit node function
This commit is contained in:
parent
5c94887949
commit
21ce678e5b
2 changed files with 14 additions and 13 deletions
|
@ -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];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue