mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 05:00:25 +08:00 
			
		
		
		
	实现最基本的域名服务节点管理
This commit is contained in:
		@@ -3,12 +3,13 @@ package ipaddressutils
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
 | 
			
		||||
	"github.com/iwind/TeaGo/maps"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// 保存一组IP地址
 | 
			
		||||
func UpdateNodeIPAddresses(parentAction *actionutils.ParentAction, nodeId int64, ipAddressesJSON []byte) error {
 | 
			
		||||
// UpdateNodeIPAddresses 保存一组IP地址
 | 
			
		||||
func UpdateNodeIPAddresses(parentAction *actionutils.ParentAction, nodeId int64, role nodeconfigs.NodeRole, ipAddressesJSON []byte) error {
 | 
			
		||||
	addresses := []maps.Map{}
 | 
			
		||||
	err := json.Unmarshal(ipAddressesJSON, &addresses)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
@@ -29,6 +30,7 @@ func UpdateNodeIPAddresses(parentAction *actionutils.ParentAction, nodeId int64,
 | 
			
		||||
		} else {
 | 
			
		||||
			_, err = parentAction.RPC().NodeIPAddressRPC().CreateNodeIPAddress(parentAction.AdminContext(), &pb.CreateNodeIPAddressRequest{
 | 
			
		||||
				NodeId:    nodeId,
 | 
			
		||||
				Role:      role,
 | 
			
		||||
				Name:      addr.GetString("name"),
 | 
			
		||||
				Ip:        addr.GetString("ip"),
 | 
			
		||||
				CanAccess: addr.GetBool("canAccess"),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user