Merge pull request #3372 from bluewave-labs/fix/ipv6-support
Fix IPv6 address handling in ping monitor (#3053)
This commit is contained in:
1 file changed
+2
-1
@@ -261,7 +261,8 @@ class NetworkService implements INetworkService {
|
|||||||
const sanitizedHost = rawUrl
|
const sanitizedHost = rawUrl
|
||||||
.replace(/^https?:\/\//, "")
|
.replace(/^https?:\/\//, "")
|
||||||
.replace(/\/.*$/, "")
|
.replace(/\/.*$/, "")
|
||||||
.replace(/:.*/, "");
|
.replace(/^\[(.+)\](?::.*)?$/, "$1") // Extract IPv6 from brackets, strip port
|
||||||
|
.replace(/^([^[\]:]+):(\d+)$/, "$1"); // Strip port from IPv4/hostname only
|
||||||
const { response, error } = await this.timeRequest(() => this.ping.promise.probe(sanitizedHost));
|
const { response, error } = await this.timeRequest(() => this.ping.promise.probe(sanitizedHost));
|
||||||
|
|
||||||
if (!response) {
|
if (!response) {
|
||||||
|
|||||||
Reference in new issue
Block a user