添加在线调试 api

This commit is contained in:
2025-03-08 10:59:31 +08:00
parent 053041ae34
commit 5786ac9d99
28 changed files with 236 additions and 539 deletions

View File

@@ -47,7 +47,7 @@ func Start() {
// 性能监控
go func() {
runtime.SetBlockProfileRate(1)
err := http.ListenAndServe(":6060", nil)
err := http.ListenAndServe(":7070", nil)
if err != nil {
slog.Error("性能监控服务启动失败", "err", err)
}
@@ -152,8 +152,8 @@ func data(addr string, tag []byte) error {
copy(tagBuf[2:], tag)
// 向目标地址建立连接
dst, err := net.Dial("tcp", addr)
if err != nil {
dst, dstErr := net.Dial("tcp", addr)
if dstErr != nil {
tagBuf[0] = 0
} else {
tagBuf[0] = 1
@@ -174,7 +174,7 @@ func data(addr string, tag []byte) error {
if dst != nil {
utils.Close(dst)
}
return errors.New("目标地址连接失败")
return errors.Wrap(dstErr, "连接目标地址失败")
}
go func() {