mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-10 23:16:38 +00:00
33 lines
757 B
TypeScript
33 lines
757 B
TypeScript
import { sendToClient } from "#dynamic/routers/ws";
|
|
import { SubnetProxyTarget } from "@server/lib/ip";
|
|
|
|
export async function addTargets(newtId: string, targets: SubnetProxyTarget[]) {
|
|
await sendToClient(newtId, {
|
|
type: `newt/wg/targets/add`,
|
|
data: targets
|
|
});
|
|
}
|
|
|
|
export async function removeTargets(
|
|
newtId: string,
|
|
targets: SubnetProxyTarget[]
|
|
) {
|
|
await sendToClient(newtId, {
|
|
type: `newt/wg/targets/remove`,
|
|
data: targets
|
|
});
|
|
}
|
|
|
|
export async function updateTargets(
|
|
newtId: string,
|
|
targets: {
|
|
oldTargets: SubnetProxyTarget[],
|
|
newTargets: SubnetProxyTarget[]
|
|
}
|
|
) {
|
|
await sendToClient(newtId, {
|
|
type: `newt/wg/targets/update`,
|
|
data: targets
|
|
});
|
|
}
|