mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-23 13:11:10 +10:00
feat: add new HeadscaleManager
This commit is contained in:
25
server/internal/p2p/headscale.ts
Normal file
25
server/internal/p2p/headscale.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import type { HeadscaleService} from "@drop-oss/headscalez";
|
||||
import { startHeadscale } from "@drop-oss/headscalez";
|
||||
|
||||
export class HeadscaleManager {
|
||||
private headscaleService?: HeadscaleService;
|
||||
|
||||
constructor() {
|
||||
this.setup();
|
||||
}
|
||||
|
||||
async setup() {
|
||||
const externalUrl = process.env.CONTROL_URL;
|
||||
if (externalUrl) {
|
||||
const headscale = await startHeadscale({ externalUrl });
|
||||
this.headscaleService = headscale;
|
||||
}
|
||||
}
|
||||
|
||||
enabled() {
|
||||
return !!this.headscaleService;
|
||||
}
|
||||
}
|
||||
|
||||
export const headscaleManager = new HeadscaleManager();
|
||||
export default headscaleManager;
|
||||
Reference in New Issue
Block a user