mirror of
				https://github.com/TeaOSLab/EdgeNode.git
				synced 2025-11-04 07:40:56 +08:00 
			
		
		
		
	[反向代理]实验性添加TOA支持
This commit is contained in:
		@@ -92,6 +92,9 @@ func (this *Node) Start() {
 | 
			
		||||
	}
 | 
			
		||||
	sharedNodeConfig = nodeConfig
 | 
			
		||||
 | 
			
		||||
	// 发送事件
 | 
			
		||||
	events.Notify(events.EventLoaded)
 | 
			
		||||
 | 
			
		||||
	// 设置rlimit
 | 
			
		||||
	_ = utils.SetRLimit(1024 * 1024)
 | 
			
		||||
 | 
			
		||||
@@ -166,10 +169,16 @@ func (this *Node) syncConfig(isFirstTime bool) error {
 | 
			
		||||
		return errors.New("create rpc client failed: " + err.Error())
 | 
			
		||||
	}
 | 
			
		||||
	// TODO 这里考虑只同步版本号有变更的
 | 
			
		||||
	configResp, err := rpcClient.NodeRPC().FindCurrentNodeConfig(rpcClient.Context(), &pb.FindCurrentNodeConfigRequest{})
 | 
			
		||||
	configResp, err := rpcClient.NodeRPC().FindCurrentNodeConfig(rpcClient.Context(), &pb.FindCurrentNodeConfigRequest{
 | 
			
		||||
		Version: lastVersion,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return errors.New("read config from rpc failed: " + err.Error())
 | 
			
		||||
	}
 | 
			
		||||
	if !configResp.IsChanged {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	configJSON := configResp.NodeJSON
 | 
			
		||||
	nodeConfig := &nodeconfigs.NodeConfig{}
 | 
			
		||||
	err = json.Unmarshal(configJSON, nodeConfig)
 | 
			
		||||
@@ -213,6 +222,9 @@ func (this *Node) syncConfig(isFirstTime bool) error {
 | 
			
		||||
	sharedWAFManager.UpdatePolicies(nodeConfig.AllHTTPFirewallPolicies())
 | 
			
		||||
	sharedNodeConfig = nodeConfig
 | 
			
		||||
 | 
			
		||||
	// 发送事件
 | 
			
		||||
	events.Notify(events.EventReload)
 | 
			
		||||
 | 
			
		||||
	if !isFirstTime {
 | 
			
		||||
		return sharedListenerManager.Start(nodeConfig)
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user