mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-07-10 06:43:11 +00:00
add coturn for test
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { runCli } from "./cli.ts";
|
||||
import { isLocalP2pRelay, startP2pRelay, stopP2pRelay } from "./docker.ts";
|
||||
import { isLocalP2pRelay, startP2pRelay, stopP2pRelay, startCoturn, stopCoturn } from "./docker.ts";
|
||||
import { waitForPort } from "./net.ts";
|
||||
|
||||
export type PeerEntry = {
|
||||
@@ -95,3 +95,17 @@ export async function stopLocalRelayIfStarted(started: boolean): Promise<void> {
|
||||
await stopP2pRelay().catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
export async function maybeStartCoturn(turnServers: string): Promise<boolean> {
|
||||
if (turnServers.includes("localhost") || turnServers.includes("127.0.0.1")) {
|
||||
await startCoturn();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export async function stopCoturnIfStarted(started: boolean): Promise<void> {
|
||||
if (started) {
|
||||
await stopCoturn().catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user