实现监控节点在线状态

This commit is contained in:
GoEdgeLab
2020-10-25 18:27:07 +08:00
parent 379ec0790e
commit 9524a0d145
6 changed files with 117 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
// +build demo
package teaconst
const (
IsDemo = true
)

View File

@@ -0,0 +1,7 @@
// +build !demo
package teaconst
const (
IsDemo = false
)

View File

@@ -46,6 +46,12 @@ func (this *IndexAction) RunGet(params struct{}) {
}
nodeMap := maps.Map{}
if message.Node != nil {
nodeMap = maps.Map{
"id": message.Node.Id,
"name": message.Node.Name,
}
}
messages = append(messages, maps.Map{
"id": message.Id,

View File

@@ -2,6 +2,7 @@ package servers
import (
"encoding/json"
teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -109,6 +110,11 @@ func (this *CreateAction) RunPost(params struct {
}
}
case serverconfigs.ServerTypeTCPProxy:
// 在DEMO模式下不能创建
if teaconst.IsDemo {
this.Fail("DEMO模式下不能创建TCP反向代理")
}
listen := []*serverconfigs.NetworkAddressConfig{}
err := json.Unmarshal([]byte(params.Addresses), &listen)
if err != nil {