From a4b692b28f2bd62d3546d666c4318e20a89e049a Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 31 Aug 2023 02:34:59 -0400 Subject: [PATCH] fix: check protocol with colon --- src/service/p2p.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/service/p2p.ts b/src/service/p2p.ts index 81278a8..daf7548 100644 --- a/src/service/p2p.ts +++ b/src/service/p2p.ts @@ -466,8 +466,8 @@ export class P2PService { unsupported.protocol = "unsupported"; const connectionUri = - connectionUris.find((uri) => ["ws", "wss"].includes(uri.protocol)) || - connectionUris.find((uri) => uri.protocol === "tcp") || + connectionUris.find((uri) => ["ws:", "wss:"].includes(uri.protocol)) || + connectionUris.find((uri) => uri.protocol === "tcp:") || unsupported; if (connectionUri.protocol === "unsupported") { @@ -497,8 +497,8 @@ export class P2PService { try { this.logger.verbose(`[connect] ${connectionUri}`); - if (protocol === "tcp") { - const ip = connectionUri.host; + if (protocol === "tcp:") { + const ip = connectionUri.hostname; const port = parseInt(connectionUri.port); const socket = await tcpConnect(port, ip);