feat: 优化代理准备并完善远端部署

- 增加严格代理、两分钟预取、白名单去重与分组状态展示\n- 增加远端注册令牌和安全地址校验\n- 增加 Docker Compose、Caddy 示例与控制中心部署文档
This commit is contained in:
yml
2026-11-21 20:59:35 +08:00
parent d176c421a8
commit 9c83be798d
43 changed files with 2755 additions and 119 deletions
+2 -9
View File
@@ -6,7 +6,6 @@ import (
"fmt"
"math/rand"
"net/http"
"net/url"
"path/filepath"
"strings"
"sync"
@@ -444,11 +443,7 @@ func cloneResults(source map[string]string) map[string]string {
}
func agentWebSocketURL(raw string) (string, error) {
raw = strings.TrimSpace(raw)
if raw == "" {
return "", errors.New("远端地址为空")
}
u, err := url.Parse(raw)
u, err := normalizeControlCenterURL(raw)
if err != nil {
return "", err
}
@@ -461,9 +456,7 @@ func agentWebSocketURL(raw string) (string, error) {
default:
return "", errors.New("远端地址必须以 http://、https://、ws:// 或 wss:// 开头")
}
if strings.TrimSpace(u.Path) == "" || u.Path == "/" {
u.Path = "/ws/agent"
}
u.Path = "/ws/agent"
return u.String(), nil
}