fix #28: ipv6 target parse fix
This commit is contained in:
1 parent
d09f31898d
commit
50fb6a429b
1 file changed
+3
-2
@@ -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
|
||||
|
||||
Reference in new issue
Block a user