反向代理源站实现使用域名分组

This commit is contained in:
GoEdgeLab
2021-09-20 11:54:21 +08:00
parent a4d8c3a27f
commit 466d5e78fa
18 changed files with 431 additions and 186 deletions

View File

@@ -8,7 +8,7 @@ import (
"time"
)
// 随机调度算法
// RandomScheduling 随机调度算法
type RandomScheduling struct {
Scheduling
@@ -16,7 +16,7 @@ type RandomScheduling struct {
count uint // 实际总的服务器数
}
// 启动
// Start 启动
func (this *RandomScheduling) Start() {
sumWeight := uint(0)
for _, c := range this.Candidates {
@@ -55,7 +55,7 @@ func (this *RandomScheduling) Start() {
rand.Seed(time.Now().UnixNano())
}
// 获取下一个候选对象
// Next 获取下一个候选对象
func (this *RandomScheduling) Next(call *shared.RequestCall) CandidateInterface {
if this.count == 0 {
return nil
@@ -67,7 +67,7 @@ func (this *RandomScheduling) Next(call *shared.RequestCall) CandidateInterface
return this.array[index]
}
// 获取简要信息
// Summary 获取简要信息
func (this *RandomScheduling) Summary() maps.Map {
return maps.Map{
"code": "random",