mirror of
https://github.com/fosrl/pangolin.git
synced 2026-11-29 02:52:57 +00:00
Remote exit nodes get their Traefik config from /hybrid/traefik-config with local sites included, and dial those targets inside the customer's own network, where localhost targets are normal. The previous commit applied the local-site restrictions to them too. - createSite only checks flags.disable_local_sites, not traefik.site_types (SaaS has ["newt"] centrally but serves local sites through remote exit nodes). - Target validation for local sites runs only when Pangolin's own Traefik serves the site (no exit node or a non-remote exit node), in createTarget, updateTarget and blueprints. - The private Traefik config skips bad local targets only when the config is not for a remote exit node. - Migration notes updated, including a query that excludes remote-node sites. PAN-1885
23 lines
824 B
TypeScript
23 lines
824 B
TypeScript
import { eq } from "drizzle-orm";
|
|
import { db, exitNodes, Transaction } from "@server/db";
|
|
|
|
/**
|
|
* Whether a local site's targets are dialled by Pangolin's own Traefik.
|
|
* Local sites on a remote exit node are served by that node's Traefik inside
|
|
* the customer's network, where localhost and similar targets are expected,
|
|
* so the local-site target restrictions only apply to the other case.
|
|
*/
|
|
export async function isLocalSiteServedByPangolin(
|
|
exitNodeId: number | null | undefined,
|
|
trx: Transaction | typeof db = db
|
|
): Promise<boolean> {
|
|
if (exitNodeId == null) {
|
|
return true;
|
|
}
|
|
const [node] = await trx
|
|
.select({ type: exitNodes.type })
|
|
.from(exitNodes)
|
|
.where(eq(exitNodes.exitNodeId, exitNodeId))
|
|
.limit(1);
|
|
return node?.type !== "remoteExitNode";
|
|
}
|