添加清空网关配置功能,更新主程序以支持清空命令

This commit is contained in:
2025-08-11 09:34:13 +08:00
parent 3782feaf85
commit 74ac39a926
5 changed files with 74 additions and 8 deletions

View File

@@ -43,6 +43,33 @@ func GatewayConfigSet(version int, macaddr string, edges []EdgeInfo) error {
return nil
}
func GatewayConfigClear(macaddr string) error {
if macaddr == "" {
return fmt.Errorf("macaddr 不能为空")
}
req := GatewayConfigSetReq{
Macaddr: macaddr,
Config: GateConfigSetReqConfig{
Id: 1,
Rules: []GateConfigSetReqRule{
{
Enable: false,
Edge: []string{"", "", "", ""},
Network: []string{},
Cityhash: "",
},
},
},
}
if _, err := Post("/gateway/config/set", req); err != nil {
return fmt.Errorf("设置网关配置失败: %v", err)
}
return nil
}
type GatewayConfigSetReq struct {
Macaddr string `json:"macaddr"`
Config GateConfigSetReqConfig `json:"config"`