package gatewayServer import ( "errors" ) // 查询 func s2c8003Query(devId string, subCode CmdCode, data string) error { a := AppDataUnit{ CmdCode: CmdCodeGetParamS2C, SubCode: subCode, DevId: devId, } a.Debug() c, ok := ConnMap[devId] if !ok { return errors.New("连接不在cMap中") } _, err := c.Write(Pack(a)) if err != nil { return err } return nil } var add1 = "add=name:test1;proto:tcp;src_dport:8888;dest_ip:192.168.1.61;dest_port:80" var add2 = "add=name:test2;proto:tcp;src_dport:8889;dest_ip:192.168.1.60;dest_port:80" var apply = "apply" // 配置 func s2c8004Set(devId string, subCode CmdCode, data string) error { a := AppDataUnit{ CmdCode: CmdCodeSetParameterS2C, SubCode: subCode, DevId: devId, Data: data, } a.Debug() c, ok := ConnMap[devId] if !ok { return errors.New("连接不在cMap中") } _, err := c.Write(Pack(a)) if err != nil { return err } return nil }