package gatewayServer import ( "errors" "fmt" ) // 查询 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 sp = "add=name:isapi;proto:tcp;src_dport:8848;dest_ip:192.168.1.64;dest_port:80" // 配置 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中") } fmt.Println("!!!!!!!!!!!!!!!") _, err := c.Write(Pack(a)) if err != nil { return err } return nil }