mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-05 09:36:37 +08:00
修复bug
This commit is contained in:
Binary file not shown.
+1
-1
@@ -119,7 +119,7 @@ func main() {
|
||||
log := xlogger.NewLogger()
|
||||
logger.SetDefault(log)
|
||||
|
||||
wsReporter := socket.StartWebSocketReporterWithConfig(config.Addr, config.Secret, "1.1.0")
|
||||
wsReporter := socket.StartWebSocketReporterWithConfig(config.Addr, config.Secret, "1.1.1")
|
||||
defer wsReporter.Stop()
|
||||
|
||||
service.SetHTTPReportURL(config.Addr, config.Secret)
|
||||
|
||||
@@ -2,9 +2,9 @@ package port
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -21,7 +21,7 @@ func ForceClosePortConnections(addr string) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
_, portStr, err := splitHostPort(addr)
|
||||
_, portStr, err := net.SplitHostPort(addr)
|
||||
if err != nil {
|
||||
fmt.Printf("⚠️ 地址解析失败: %v\n", err)
|
||||
return nil
|
||||
@@ -56,18 +56,3 @@ func ForceClosePortConnections(addr string) (err error) {
|
||||
fmt.Printf("✅ 正在断开端口 %d 上的所有连接...\n", port)
|
||||
return nil
|
||||
}
|
||||
|
||||
func splitHostPort(addr string) (string, string, error) {
|
||||
if !strings.Contains(addr, ":") {
|
||||
return "", "", fmt.Errorf("missing port in address")
|
||||
}
|
||||
return netSplitHostPortCompat(addr)
|
||||
}
|
||||
|
||||
func netSplitHostPortCompat(addr string) (string, string, error) {
|
||||
lastColon := strings.LastIndex(addr, ":")
|
||||
if lastColon < 0 {
|
||||
return "", "", fmt.Errorf("missing port")
|
||||
}
|
||||
return addr[:lastColon], addr[lastColon+1:], nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user