mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-06 10:06:36 +08:00
增加网站配置
This commit is contained in:
Binary file not shown.
+1
-1
@@ -119,7 +119,7 @@ func main() {
|
|||||||
log := xlogger.NewLogger()
|
log := xlogger.NewLogger()
|
||||||
logger.SetDefault(log)
|
logger.SetDefault(log)
|
||||||
|
|
||||||
wsReporter := socket.StartWebSocketReporterWithConfig(config.Addr, config.Secret, "1.0.6")
|
wsReporter := socket.StartWebSocketReporterWithConfig(config.Addr, config.Secret, "1.0.7")
|
||||||
defer wsReporter.Stop()
|
defer wsReporter.Stop()
|
||||||
|
|
||||||
service.SetHTTPReportURL(config.Addr, config.Secret)
|
service.SetHTTPReportURL(config.Addr, config.Secret)
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ type TcpPingRequest struct {
|
|||||||
IP string `json:"ip"`
|
IP string `json:"ip"`
|
||||||
Port int `json:"port"`
|
Port int `json:"port"`
|
||||||
Count int `json:"count"`
|
Count int `json:"count"`
|
||||||
Timeout int `json:"timeout"` // 超时时间(毫秒)
|
Timeout int `json:"timeout"` // 超时时间(毫秒)
|
||||||
RequestId string `json:"requestId,omitempty"`
|
RequestId string `json:"requestId,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1013,7 +1013,10 @@ func tcpPingHost(ip string, port int, count int, timeoutMs int) (float64, float6
|
|||||||
var successCount int
|
var successCount int
|
||||||
|
|
||||||
timeout := time.Duration(timeoutMs) * time.Millisecond
|
timeout := time.Duration(timeoutMs) * time.Millisecond
|
||||||
target := fmt.Sprintf("%s:%d", ip, port)
|
|
||||||
|
// 使用net.JoinHostPort来正确处理IPv4、IPv6和域名
|
||||||
|
// 它会自动为IPv6地址添加方括号
|
||||||
|
target := net.JoinHostPort(ip, fmt.Sprintf("%d", port))
|
||||||
|
|
||||||
fmt.Printf("🔍 开始TCP ping测试: %s,次数: %d,超时: %dms\n", target, count, timeoutMs)
|
fmt.Printf("🔍 开始TCP ping测试: %s,次数: %d,超时: %dms\n", target, count, timeoutMs)
|
||||||
|
|
||||||
@@ -1052,8 +1055,6 @@ func tcpPingHost(ip string, port int, count int, timeoutMs int) (float64, float6
|
|||||||
return avgTime, packetLoss, nil
|
return avgTime, packetLoss, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// isValidHostname 验证主机名格式
|
// isValidHostname 验证主机名格式
|
||||||
func isValidHostname(hostname string) bool {
|
func isValidHostname(hostname string) bool {
|
||||||
if len(hostname) == 0 || len(hostname) > 253 {
|
if len(hostname) == 0 || len(hostname) > 253 {
|
||||||
|
|||||||
Reference in New Issue
Block a user