mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-07 11:16:37 +00:00
Import tcm
This commit is contained in:
@@ -6,8 +6,13 @@ import config from "@server/lib/config";
|
|||||||
import { WebSocketClient, createWebSocketClient } from "./routers/ws/client";
|
import { WebSocketClient, createWebSocketClient } from "./routers/ws/client";
|
||||||
import { addPeer, deletePeer } from "./routers/gerbil/peers";
|
import { addPeer, deletePeer } from "./routers/gerbil/peers";
|
||||||
import { db, exitNodes } from "./db";
|
import { db, exitNodes } from "./db";
|
||||||
|
import { TraefikConfigManager } from "./lib/remoteTraefikConfig";
|
||||||
|
|
||||||
export async function createHybridClientServer() {
|
export async function createHybridClientServer() {
|
||||||
|
const monitor = new TraefikConfigManager();
|
||||||
|
|
||||||
|
await monitor.start();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!config.getRawConfig().hybrid?.id ||
|
!config.getRawConfig().hybrid?.id ||
|
||||||
!config.getRawConfig().hybrid?.secret ||
|
!config.getRawConfig().hybrid?.secret ||
|
||||||
@@ -33,7 +38,7 @@ export async function createHybridClientServer() {
|
|||||||
client.registerHandler("remote/peers/add", async (message) => {
|
client.registerHandler("remote/peers/add", async (message) => {
|
||||||
const { pubKey, allowedIps } = message.data;
|
const { pubKey, allowedIps } = message.data;
|
||||||
|
|
||||||
// TODO: we are getting the exit node twice here
|
// TODO: we are getting the exit node twice here
|
||||||
// NOTE: there should only be one gerbil registered so...
|
// NOTE: there should only be one gerbil registered so...
|
||||||
const [exitNode] = await db.select().from(exitNodes).limit(1);
|
const [exitNode] = await db.select().from(exitNodes).limit(1);
|
||||||
await addPeer(exitNode.exitNodeId, {
|
await addPeer(exitNode.exitNodeId, {
|
||||||
@@ -45,7 +50,7 @@ export async function createHybridClientServer() {
|
|||||||
client.registerHandler("remote/peers/remove", async (message) => {
|
client.registerHandler("remote/peers/remove", async (message) => {
|
||||||
const { pubKey } = message.data;
|
const { pubKey } = message.data;
|
||||||
|
|
||||||
// TODO: we are getting the exit node twice here
|
// TODO: we are getting the exit node twice here
|
||||||
// NOTE: there should only be one gerbil registered so...
|
// NOTE: there should only be one gerbil registered so...
|
||||||
const [exitNode] = await db.select().from(exitNodes).limit(1);
|
const [exitNode] = await db.select().from(exitNodes).limit(1);
|
||||||
await deletePeer(exitNode.exitNodeId, pubKey);
|
await deletePeer(exitNode.exitNodeId, pubKey);
|
||||||
|
|||||||
Reference in New Issue
Block a user