diff --git a/worker/src/monitor.ts b/worker/src/monitor.ts index 1dda46e..1e6f8d4 100644 --- a/worker/src/monitor.ts +++ b/worker/src/monitor.ts @@ -16,8 +16,9 @@ export async function getStatus( if (monitor.method === 'TCP_PING') { // TCP port endpoint monitor try { - const [hostname, port] = monitor.target.split(':') - const socket = connect({ hostname: hostname, port: Number(port) }) + // This is not a real https connection, but we need to add a dummy `https://` to parse the hostname & port + const parsed = new URL("https://" + monitor.target) + const socket = connect({ hostname: parsed.hostname, port: Number(parsed.port) }) // Now we have an `opened` promise! // @ts-ignore