实现请求连接数等限制

This commit is contained in:
GoEdgeLab
2021-12-12 11:48:01 +08:00
parent e2d504d9e6
commit 5ef3072734
20 changed files with 632 additions and 86 deletions

View File

@@ -108,6 +108,20 @@ func main() {
}
}
})
app.On("conns", func() {
var sock = gosock.NewTmpSock(teaconst.ProcessName)
reply, err := sock.Send(&gosock.Command{Code: "conns"})
if err != nil {
fmt.Println("[ERROR]" + err.Error())
} else {
resultJSON, err := json.MarshalIndent(reply.Params, "", " ")
if err != nil {
fmt.Println("[ERROR]" + err.Error())
} else {
fmt.Println(string(resultJSON))
}
}
})
app.Run(func() {
node := nodes.NewNode()
node.Start()