diff --git a/internal/config/config.go b/internal/config/config.go index 593b474..82c4dc2 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -319,7 +319,7 @@ type StaticConfig struct { // 注意事项: // - Path 使用前缀匹配,较长路径优先匹配 // - 至少配置一个 Target 才能正常工作 -// - 负载均衡算法支持:round_robin、weighted_round_robin、least_conn、ip_hash、consistent_hash +// - 负载均衡算法支持:round_robin、weighted_round_robin、least_conn、ip_hash、consistent_hash、random // - 一致性哈希需要配置 HashKey // // 使用示例: diff --git a/internal/proxy/health.go b/internal/proxy/health.go index 07fd51d..9a9363e 100644 --- a/internal/proxy/health.go +++ b/internal/proxy/health.go @@ -120,11 +120,14 @@ func (h *HealthChecker) Start() { // Stop 停止后台健康检查进程。 // 它向后台 goroutine 发送停止信号并等待其完成。 // Stop 是幂等的;在已停止的检查器上调用它不会产生任何效果。 +// Stop 后可以再次调用 Start 重新启动检查器。 func (h *HealthChecker) Stop() { if !h.running.CompareAndSwap(true, false) { return // 已经停止,直接返回 } close(h.stopCh) + // 重新创建 stopCh 以支持后续 Start + h.stopCh = make(chan struct{}) } // run 是在后台 goroutine 中运行的主要健康检查循环。