mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 12:40:07 +00:00
✨ 反向代理 gRPC 端口(支持 Cloudflare CDN)
This commit is contained in:
@@ -193,6 +193,7 @@ func main() {
|
||||
go rpc.ServeRPC(dao.Conf.GRPCPort)
|
||||
serviceSentinelDispatchBus := make(chan model.Monitor)
|
||||
go rpc.DispatchTask(serviceSentinelDispatchBus)
|
||||
go rpc.DispatchKeepalive()
|
||||
go dao.AlertSentinelStart()
|
||||
dao.NewServiceSentinel(serviceSentinelDispatchBus)
|
||||
srv := controller.ServeWeb(dao.Conf.HTTPPort)
|
||||
|
||||
@@ -57,3 +57,17 @@ func DispatchTask(serviceSentinelDispatchBus <-chan model.Monitor) {
|
||||
dao.SortedServerLock.RUnlock()
|
||||
}
|
||||
}
|
||||
|
||||
func DispatchKeepalive() {
|
||||
dao.Cron.AddFunc("@every 60s", func() {
|
||||
dao.SortedServerLock.RLock()
|
||||
defer dao.SortedServerLock.RUnlock()
|
||||
for i := 0; i < len(dao.SortedServerList); i++ {
|
||||
if dao.SortedServerList[i] == nil || dao.SortedServerList[i].TaskStream == nil || dao.SortedServerList[i].TaskStream.Context().Err() != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
dao.SortedServerList[i].TaskStream.Send(&pb.Task{Type: model.TaskTypeKeepalive})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user