mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 07:50:25 +08:00 
			
		
		
		
	自动将API节点的IP加入到白名单,防止误封
This commit is contained in:
		@@ -519,9 +519,9 @@ func (this *NodeDAO) FindAllInactiveNodesWithClusterId(tx *dbs.Tx, clusterId int
 | 
			
		||||
	_, err = this.Query(tx).
 | 
			
		||||
		State(NodeStateEnabled).
 | 
			
		||||
		Attr("clusterId", clusterId).
 | 
			
		||||
		Attr("isOn", true). // 只监控启用的节点
 | 
			
		||||
		Attr("isOn", true).        // 只监控启用的节点
 | 
			
		||||
		Attr("isInstalled", true). // 只监控已经安装的节点
 | 
			
		||||
		Attr("isActive", true). // 当前已经在线的
 | 
			
		||||
		Attr("isActive", true).    // 当前已经在线的
 | 
			
		||||
		Where("(status IS NULL OR (JSON_EXTRACT(status, '$.isActive')=false AND UNIX_TIMESTAMP()-JSON_EXTRACT(status, '$.updatedAt')>10) OR  UNIX_TIMESTAMP()-JSON_EXTRACT(status, '$.updatedAt')>120)").
 | 
			
		||||
		Result("id", "name").
 | 
			
		||||
		Slice(&result).
 | 
			
		||||
@@ -727,6 +727,13 @@ func (this *NodeDAO) ComposeNodeConfig(tx *dbs.Tx, nodeId int64, cacheMap *utils
 | 
			
		||||
		RegionId: int64(node.RegionId),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// API节点IP
 | 
			
		||||
	apiNodeIPs, err := SharedAPINodeDAO.FindAllEnabledAPIAccessIPs(tx, cacheMap)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	config.AllowedIPs = append(config.AllowedIPs, apiNodeIPs...)
 | 
			
		||||
 | 
			
		||||
	// 获取所有的服务
 | 
			
		||||
	servers, err := SharedServerDAO.FindAllEnabledServersWithNode(tx, int64(node.Id))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user