fix: check protocol with colon

This commit is contained in:
Derrick Hammer 2023-08-31 02:34:59 -04:00
parent 17ff5fd96b
commit a4b692b28f
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 4 deletions

View File

@ -466,8 +466,8 @@ export class P2PService {
unsupported.protocol = "unsupported"; unsupported.protocol = "unsupported";
const connectionUri = const connectionUri =
connectionUris.find((uri) => ["ws", "wss"].includes(uri.protocol)) || connectionUris.find((uri) => ["ws:", "wss:"].includes(uri.protocol)) ||
connectionUris.find((uri) => uri.protocol === "tcp") || connectionUris.find((uri) => uri.protocol === "tcp:") ||
unsupported; unsupported;
if (connectionUri.protocol === "unsupported") { if (connectionUri.protocol === "unsupported") {
@ -497,8 +497,8 @@ export class P2PService {
try { try {
this.logger.verbose(`[connect] ${connectionUri}`); this.logger.verbose(`[connect] ${connectionUri}`);
if (protocol === "tcp") { if (protocol === "tcp:") {
const ip = connectionUri.host; const ip = connectionUri.hostname;
const port = parseInt(connectionUri.port); const port = parseInt(connectionUri.port);
const socket = await tcpConnect(port, ip); const socket = await tcpConnect(port, ip);