在各个地方支持IPv6

This commit is contained in:
刘祥超
2021-07-20 10:55:25 +08:00
parent fb263c926b
commit 60b8e1041c
12 changed files with 59 additions and 16 deletions

View File

@@ -396,7 +396,7 @@ window.teaweb = {
}
let tooltipFunc = options.tooltip
if (typeof(tooltipFunc) != "function") {
if (typeof (tooltipFunc) != "function") {
throw new Error("'options.tooltip' should be a function")
}
@@ -524,3 +524,17 @@ window.teaweb = {
chart.resize()
}
}
String.prototype.quoteIP = function () {
let ip = this.toString()
if (ip.length == 0) {
return ""
}
if (ip.indexOf(":") < 0) {
return ip
}
if (ip.substring(0, 1) == "[") {
return ip
}
return "[" + ip + "]"
}