添加清空网关配置功能,更新主程序以支持清空命令
This commit is contained in:
@@ -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"`
|
||||
|
||||
Reference in New Issue
Block a user