fix: allow explicit private targets on relay service

This commit is contained in:
illusia committed 2026-09-10 15:35:57 +08:00
1 parent 7782e9b327
commit 06e5cc6d8b
1 file changed
+5
+5
View File
@@ -7,6 +7,7 @@ const server = await createAccelerationRelayServer({
host: process.env.WEBSPEAK_ACCELERATION_RELAY_HOST?.trim() || "0.0.0.0",
port: parsePort(process.env.WEBSPEAK_ACCELERATION_RELAY_PORT, 39087),
token,
allowPrivate: parseBoolean(process.env.WEBSPEAK_ACCELERATION_RELAY_ALLOW_PRIVATE),
});
console.log(`WebSpeak acceleration relay listening on ${server.host}:${server.port}`);
@@ -23,3 +24,7 @@ function parsePort(value: string | undefined, fallback: number): number {
if (!Number.isInteger(port) || port < 1 || port > 65535) throw new Error("Invalid WEBSPEAK_ACCELERATION_RELAY_PORT");
return port;
}
function parseBoolean(value: string | undefined): boolean {
return value === "1" || value?.toLowerCase() === "true";
}