阶段性提交

This commit is contained in:
刘祥超
2020-07-22 22:18:47 +08:00
parent 219732c1df
commit fa7edac94b
19 changed files with 716 additions and 14 deletions

View File

@@ -2,10 +2,12 @@ package nodes
import (
"github.com/TeaOSLab/EdgeNode/internal/configs"
"github.com/TeaOSLab/EdgeNode/internal/utils"
"github.com/iwind/TeaGo/logs"
)
var sharedNodeConfig *configs.NodeConfig = nil
var stop = make(chan bool)
type Node struct {
}
@@ -15,6 +17,7 @@ func NewNode() *Node {
}
func (this *Node) Start() {
// 读取配置
nodeConfig, err := configs.SharedNodeConfig()
if err != nil {
logs.Println("[NODE]start failed: read node config failed: " + err.Error())
@@ -22,5 +25,15 @@ func (this *Node) Start() {
}
sharedNodeConfig = nodeConfig
logs.PrintAsJSON(nodeConfig)
// 设置rlimit
_ = utils.SetRLimit(1024 * 1024)
// 启动端口
err = sharedListenerManager.Start(nodeConfig)
if err != nil {
logs.Println("[NODE]start failed: " + err.Error())
}
// hold住进程
<-stop
}