diff --git a/cmd.pb.go b/cmd.pb.go index 4084b0b..4ee7ec5 100644 --- a/cmd.pb.go +++ b/cmd.pb.go @@ -289,6 +289,7 @@ func (CmdErrorCode) EnumDescriptor() ([]byte, []int) { return file_cmd_proto_rawDescGZIP(), []int{3} } +// TaskStatus 任务状态 type TaskStatus int32 const ( @@ -353,22 +354,22 @@ func (TaskStatus) EnumDescriptor() ([]byte, []int) { type OS int32 const ( - OS_UNKNOWN OS = 0 - OS_IOS OS = 1 - OS_ANDROID OS = 2 + OS_OS_UNKNOWN OS = 0 + OS_IOS OS = 1 + OS_ANDROID OS = 2 ) // Enum value maps for OS. var ( OS_name = map[int32]string{ - 0: "UNKNOWN", + 0: "OS_UNKNOWN", 1: "IOS", 2: "ANDROID", } OS_value = map[string]int32{ - "UNKNOWN": 0, - "IOS": 1, - "ANDROID": 2, + "OS_UNKNOWN": 0, + "IOS": 1, + "ANDROID": 2, } ) @@ -399,6 +400,59 @@ func (OS) EnumDescriptor() ([]byte, []int) { return file_cmd_proto_rawDescGZIP(), []int{5} } +// MAX 最大限定 +type MAX int32 + +const ( + MAX_MAX_UNKNOWN MAX = 0 + MAX_U8 MAX = 64 + MAX_U32 MAX = 8 + MAX_FLAG MAX = 4 +) + +// Enum value maps for MAX. +var ( + MAX_name = map[int32]string{ + 0: "MAX_UNKNOWN", + 64: "U8", + 8: "U32", + 4: "FLAG", + } + MAX_value = map[string]int32{ + "MAX_UNKNOWN": 0, + "U8": 64, + "U32": 8, + "FLAG": 4, + } +) + +func (x MAX) Enum() *MAX { + p := new(MAX) + *p = x + return p +} + +func (x MAX) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (MAX) Descriptor() protoreflect.EnumDescriptor { + return file_cmd_proto_enumTypes[6].Descriptor() +} + +func (MAX) Type() protoreflect.EnumType { + return &file_cmd_proto_enumTypes[6] +} + +func (x MAX) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use MAX.Descriptor instead. +func (MAX) EnumDescriptor() ([]byte, []int) { + return file_cmd_proto_rawDescGZIP(), []int{6} +} + // SaasReq 命令请求 type SaasReq struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -957,10 +1011,11 @@ func (x *WriteItem) GetWriteFlagsWithExpire() *FlagsWithExpire { // Bytes 写入byte区域 type Bytes struct { - state protoimpl.MessageState `protogen:"open.v1"` - Bytes []byte `protobuf:"bytes,1,opt,name=bytes,proto3" json:"bytes,omitempty"` // 写入的byte - Index_1 uint64 `protobuf:"varint,2,opt,name=index_1,json=index1,proto3" json:"index_1,omitempty"` // 写入byte的索引值(0..63) - Index_2 uint64 `protobuf:"varint,3,opt,name=index_2,json=index2,proto3" json:"index_2,omitempty"` // 写入byte的索引值(64..127) + state protoimpl.MessageState `protogen:"open.v1"` + Bytes []byte `protobuf:"bytes,1,opt,name=bytes,proto3" json:"bytes,omitempty"` // 写入的byte + Index_1 uint64 `protobuf:"varint,2,opt,name=index_1,json=index1,proto3" json:"index_1,omitempty"` // 写入byte的索引值(0..63) + // Deprecated: Marked as deprecated in cmd.proto. + Index_2 uint64 `protobuf:"varint,3,opt,name=index_2,json=index2,proto3" json:"index_2,omitempty"` // **已弃用 写入byte的索引值(64..127) unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -1009,6 +1064,7 @@ func (x *Bytes) GetIndex_1() uint64 { return 0 } +// Deprecated: Marked as deprecated in cmd.proto. func (x *Bytes) GetIndex_2() uint64 { if x != nil { return x.Index_2 @@ -1020,7 +1076,7 @@ func (x *Bytes) GetIndex_2() uint64 { type Uint32S struct { state protoimpl.MessageState `protogen:"open.v1"` Uint32S []uint32 `protobuf:"varint,1,rep,packed,name=uint32s,proto3" json:"uint32s,omitempty"` // 写入的uint32 - Index_1 uint64 `protobuf:"varint,2,opt,name=index_1,json=index1,proto3" json:"index_1,omitempty"` // 写入uint32的索引值(0..15) 最多 16 个 + Index_1 uint64 `protobuf:"varint,2,opt,name=index_1,json=index1,proto3" json:"index_1,omitempty"` // 写入uint32的索引值(0..7) 最多 8 个 unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -1073,7 +1129,7 @@ func (x *Uint32S) GetIndex_1() uint64 { type FlagsWithExpire struct { state protoimpl.MessageState `protogen:"open.v1"` FlagsWithExpire []*FlagWithExpire `protobuf:"bytes,1,rep,name=flags_with_expire,json=flagsWithExpire,proto3" json:"flags_with_expire,omitempty"` // 写入的标志位 - Index_1 uint64 `protobuf:"varint,2,opt,name=index_1,json=index1,proto3" json:"index_1,omitempty"` // 写入标志位的索引值 + Index_1 uint64 `protobuf:"varint,2,opt,name=index_1,json=index1,proto3" json:"index_1,omitempty"` // 写入标志位的索引值(0..3) 最多 4 个 unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -1912,7 +1968,7 @@ func (x *ScriptRun) GetOs() OS { if x != nil { return x.Os } - return OS_UNKNOWN + return OS_OS_UNKNOWN } // ScriptUpdate 升级脚本 @@ -2227,18 +2283,70 @@ func (*SaasRes_ScriptRunRes) isSaasRes_Res() {} func (*SaasRes_ScriptUpdateRes) isSaasRes_Res() {} +type DataSpace struct { + state protoimpl.MessageState `protogen:"open.v1"` + Did []string `protobuf:"bytes,1,rep,name=did,proto3" json:"did,omitempty"` // 设备ID区 + Wuid []string `protobuf:"bytes,2,rep,name=wuid,proto3" json:"wuid,omitempty"` // OpenID区 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DataSpace) Reset() { + *x = DataSpace{} + mi := &file_cmd_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DataSpace) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DataSpace) ProtoMessage() {} + +func (x *DataSpace) ProtoReflect() protoreflect.Message { + mi := &file_cmd_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DataSpace.ProtoReflect.Descriptor instead. +func (*DataSpace) Descriptor() ([]byte, []int) { + return file_cmd_proto_rawDescGZIP(), []int{24} +} + +func (x *DataSpace) GetDid() []string { + if x != nil { + return x.Did + } + return nil +} + +func (x *DataSpace) GetWuid() []string { + if x != nil { + return x.Wuid + } + return nil +} + // InfoRes 账号信息返回 type InfoRes struct { state protoimpl.MessageState `protogen:"open.v1"` - DataspaceId []string `protobuf:"bytes,1,rep,name=dataspace_id,json=dataspaceId,proto3" json:"dataspace_id,omitempty"` // 可用数据区列表 - TargetId []string `protobuf:"bytes,2,rep,name=target_id,json=targetId,proto3" json:"target_id,omitempty"` // 策略ID列表 + Dataspace *DataSpace `protobuf:"bytes,1,opt,name=dataspace,proto3" json:"dataspace,omitempty"` // 可用数据区列表 + TargetId []string `protobuf:"bytes,2,rep,name=target_id,json=targetId,proto3" json:"target_id,omitempty"` // 策略ID列表 unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *InfoRes) Reset() { *x = InfoRes{} - mi := &file_cmd_proto_msgTypes[24] + mi := &file_cmd_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2250,7 +2358,7 @@ func (x *InfoRes) String() string { func (*InfoRes) ProtoMessage() {} func (x *InfoRes) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[24] + mi := &file_cmd_proto_msgTypes[25] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2263,12 +2371,12 @@ func (x *InfoRes) ProtoReflect() protoreflect.Message { // Deprecated: Use InfoRes.ProtoReflect.Descriptor instead. func (*InfoRes) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{24} + return file_cmd_proto_rawDescGZIP(), []int{25} } -func (x *InfoRes) GetDataspaceId() []string { +func (x *InfoRes) GetDataspace() *DataSpace { if x != nil { - return x.DataspaceId + return x.Dataspace } return nil } @@ -2292,7 +2400,7 @@ type ReadRes struct { func (x *ReadRes) Reset() { *x = ReadRes{} - mi := &file_cmd_proto_msgTypes[25] + mi := &file_cmd_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2304,7 +2412,7 @@ func (x *ReadRes) String() string { func (*ReadRes) ProtoMessage() {} func (x *ReadRes) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[25] + mi := &file_cmd_proto_msgTypes[26] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2317,7 +2425,7 @@ func (x *ReadRes) ProtoReflect() protoreflect.Message { // Deprecated: Use ReadRes.ProtoReflect.Descriptor instead. func (*ReadRes) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{25} + return file_cmd_proto_rawDescGZIP(), []int{26} } func (x *ReadRes) GetSuccCmdCount() uint32 { @@ -2353,7 +2461,7 @@ type WriteRes struct { func (x *WriteRes) Reset() { *x = WriteRes{} - mi := &file_cmd_proto_msgTypes[26] + mi := &file_cmd_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2365,7 +2473,7 @@ func (x *WriteRes) String() string { func (*WriteRes) ProtoMessage() {} func (x *WriteRes) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[26] + mi := &file_cmd_proto_msgTypes[27] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2378,7 +2486,7 @@ func (x *WriteRes) ProtoReflect() protoreflect.Message { // Deprecated: Use WriteRes.ProtoReflect.Descriptor instead. func (*WriteRes) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{26} + return file_cmd_proto_rawDescGZIP(), []int{27} } func (x *WriteRes) GetFailedUserid() []string { @@ -2403,7 +2511,7 @@ type ValueItem struct { func (x *ValueItem) Reset() { *x = ValueItem{} - mi := &file_cmd_proto_msgTypes[27] + mi := &file_cmd_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2415,7 +2523,7 @@ func (x *ValueItem) String() string { func (*ValueItem) ProtoMessage() {} func (x *ValueItem) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[27] + mi := &file_cmd_proto_msgTypes[28] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2428,7 +2536,7 @@ func (x *ValueItem) ProtoReflect() protoreflect.Message { // Deprecated: Use ValueItem.ProtoReflect.Descriptor instead. func (*ValueItem) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{27} + return file_cmd_proto_rawDescGZIP(), []int{28} } func (x *ValueItem) GetCmdIndex() uint32 { @@ -2483,7 +2591,7 @@ type TaskListRes struct { func (x *TaskListRes) Reset() { *x = TaskListRes{} - mi := &file_cmd_proto_msgTypes[28] + mi := &file_cmd_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2495,7 +2603,7 @@ func (x *TaskListRes) String() string { func (*TaskListRes) ProtoMessage() {} func (x *TaskListRes) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[28] + mi := &file_cmd_proto_msgTypes[29] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2508,7 +2616,7 @@ func (x *TaskListRes) ProtoReflect() protoreflect.Message { // Deprecated: Use TaskListRes.ProtoReflect.Descriptor instead. func (*TaskListRes) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{28} + return file_cmd_proto_rawDescGZIP(), []int{29} } func (x *TaskListRes) GetTasks() []*Task { @@ -2528,7 +2636,7 @@ type TargetListRes struct { func (x *TargetListRes) Reset() { *x = TargetListRes{} - mi := &file_cmd_proto_msgTypes[29] + mi := &file_cmd_proto_msgTypes[30] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2540,7 +2648,7 @@ func (x *TargetListRes) String() string { func (*TargetListRes) ProtoMessage() {} func (x *TargetListRes) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[29] + mi := &file_cmd_proto_msgTypes[30] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2553,7 +2661,7 @@ func (x *TargetListRes) ProtoReflect() protoreflect.Message { // Deprecated: Use TargetListRes.ProtoReflect.Descriptor instead. func (*TargetListRes) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{29} + return file_cmd_proto_rawDescGZIP(), []int{30} } func (x *TargetListRes) GetTargetList() map[string]*Binds { @@ -2572,7 +2680,7 @@ type Binds struct { func (x *Binds) Reset() { *x = Binds{} - mi := &file_cmd_proto_msgTypes[30] + mi := &file_cmd_proto_msgTypes[31] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2584,7 +2692,7 @@ func (x *Binds) String() string { func (*Binds) ProtoMessage() {} func (x *Binds) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[30] + mi := &file_cmd_proto_msgTypes[31] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2597,7 +2705,7 @@ func (x *Binds) ProtoReflect() protoreflect.Message { // Deprecated: Use Binds.ProtoReflect.Descriptor instead. func (*Binds) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{30} + return file_cmd_proto_rawDescGZIP(), []int{31} } func (x *Binds) GetBinds() []*Bind { @@ -2621,7 +2729,7 @@ type Bind struct { func (x *Bind) Reset() { *x = Bind{} - mi := &file_cmd_proto_msgTypes[31] + mi := &file_cmd_proto_msgTypes[32] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2633,7 +2741,7 @@ func (x *Bind) String() string { func (*Bind) ProtoMessage() {} func (x *Bind) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[31] + mi := &file_cmd_proto_msgTypes[32] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2646,7 +2754,7 @@ func (x *Bind) ProtoReflect() protoreflect.Message { // Deprecated: Use Bind.ProtoReflect.Descriptor instead. func (*Bind) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{31} + return file_cmd_proto_rawDescGZIP(), []int{32} } func (x *Bind) GetBindId() int64 { @@ -2696,7 +2804,7 @@ type BindSetRes struct { func (x *BindSetRes) Reset() { *x = BindSetRes{} - mi := &file_cmd_proto_msgTypes[32] + mi := &file_cmd_proto_msgTypes[33] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2708,7 +2816,7 @@ func (x *BindSetRes) String() string { func (*BindSetRes) ProtoMessage() {} func (x *BindSetRes) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[32] + mi := &file_cmd_proto_msgTypes[33] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2721,7 +2829,7 @@ func (x *BindSetRes) ProtoReflect() protoreflect.Message { // Deprecated: Use BindSetRes.ProtoReflect.Descriptor instead. func (*BindSetRes) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{32} + return file_cmd_proto_rawDescGZIP(), []int{33} } func (x *BindSetRes) GetSuccessNum() int32 { @@ -2757,7 +2865,7 @@ type BindDeleteRes struct { func (x *BindDeleteRes) Reset() { *x = BindDeleteRes{} - mi := &file_cmd_proto_msgTypes[33] + mi := &file_cmd_proto_msgTypes[34] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2769,7 +2877,7 @@ func (x *BindDeleteRes) String() string { func (*BindDeleteRes) ProtoMessage() {} func (x *BindDeleteRes) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[33] + mi := &file_cmd_proto_msgTypes[34] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2782,7 +2890,7 @@ func (x *BindDeleteRes) ProtoReflect() protoreflect.Message { // Deprecated: Use BindDeleteRes.ProtoReflect.Descriptor instead. func (*BindDeleteRes) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{33} + return file_cmd_proto_rawDescGZIP(), []int{34} } func (x *BindDeleteRes) GetSuccessNum() int32 { @@ -2818,7 +2926,7 @@ type BindError struct { func (x *BindError) Reset() { *x = BindError{} - mi := &file_cmd_proto_msgTypes[34] + mi := &file_cmd_proto_msgTypes[35] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2830,7 +2938,7 @@ func (x *BindError) String() string { func (*BindError) ProtoMessage() {} func (x *BindError) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[34] + mi := &file_cmd_proto_msgTypes[35] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2843,7 +2951,7 @@ func (x *BindError) ProtoReflect() protoreflect.Message { // Deprecated: Use BindError.ProtoReflect.Descriptor instead. func (*BindError) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{34} + return file_cmd_proto_rawDescGZIP(), []int{35} } func (x *BindError) GetBindId() int64 { @@ -2880,7 +2988,7 @@ type ScriptRunRes struct { func (x *ScriptRunRes) Reset() { *x = ScriptRunRes{} - mi := &file_cmd_proto_msgTypes[35] + mi := &file_cmd_proto_msgTypes[36] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2892,7 +3000,7 @@ func (x *ScriptRunRes) String() string { func (*ScriptRunRes) ProtoMessage() {} func (x *ScriptRunRes) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[35] + mi := &file_cmd_proto_msgTypes[36] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2905,7 +3013,7 @@ func (x *ScriptRunRes) ProtoReflect() protoreflect.Message { // Deprecated: Use ScriptRunRes.ProtoReflect.Descriptor instead. func (*ScriptRunRes) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{35} + return file_cmd_proto_rawDescGZIP(), []int{36} } func (x *ScriptRunRes) GetPrintOutput() string { @@ -2945,7 +3053,7 @@ type ScriptUpdateRes struct { func (x *ScriptUpdateRes) Reset() { *x = ScriptUpdateRes{} - mi := &file_cmd_proto_msgTypes[36] + mi := &file_cmd_proto_msgTypes[37] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2957,7 +3065,7 @@ func (x *ScriptUpdateRes) String() string { func (*ScriptUpdateRes) ProtoMessage() {} func (x *ScriptUpdateRes) ProtoReflect() protoreflect.Message { - mi := &file_cmd_proto_msgTypes[36] + mi := &file_cmd_proto_msgTypes[37] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2970,7 +3078,7 @@ func (x *ScriptUpdateRes) ProtoReflect() protoreflect.Message { // Deprecated: Use ScriptUpdateRes.ProtoReflect.Descriptor instead. func (*ScriptUpdateRes) Descriptor() ([]byte, []int) { - return file_cmd_proto_rawDescGZIP(), []int{36} + return file_cmd_proto_rawDescGZIP(), []int{37} } var File_cmd_proto protoreflect.FileDescriptor @@ -3019,11 +3127,11 @@ const file_cmd_proto_rawDesc = "" + "\vwrite_bytes\x18\x02 \x01(\v2\x0e.saasapi.BytesR\n" + "writeBytes\x125\n" + "\rwrite_uint32s\x18\x03 \x01(\v2\x10.saasapi.Uint32sR\fwriteUint32s\x12O\n" + - "\x17write_flags_with_expire\x18\x04 \x01(\v2\x18.saasapi.FlagsWithExpireR\x14writeFlagsWithExpire\"O\n" + + "\x17write_flags_with_expire\x18\x04 \x01(\v2\x18.saasapi.FlagsWithExpireR\x14writeFlagsWithExpire\"S\n" + "\x05Bytes\x12\x14\n" + "\x05bytes\x18\x01 \x01(\fR\x05bytes\x12\x17\n" + - "\aindex_1\x18\x02 \x01(\x04R\x06index1\x12\x17\n" + - "\aindex_2\x18\x03 \x01(\x04R\x06index2\"<\n" + + "\aindex_1\x18\x02 \x01(\x04R\x06index1\x12\x1b\n" + + "\aindex_2\x18\x03 \x01(\x04B\x02\x18\x01R\x06index2\"<\n" + "\aUint32s\x12\x18\n" + "\auint32s\x18\x01 \x03(\rR\auint32s\x12\x17\n" + "\aindex_1\x18\x02 \x01(\x04R\x06index1\"o\n" + @@ -3117,9 +3225,12 @@ const file_cmd_proto_rawDesc = "" + "\x0fbind_delete_res\x18> \x01(\v2\x16.saasapi.BindDeleteResH\x00R\rbindDeleteRes\x12=\n" + "\x0escript_run_res\x18Z \x01(\v2\x15.saasapi.ScriptRunResH\x00R\fscriptRunRes\x12F\n" + "\x11script_update_res\x18[ \x01(\v2\x18.saasapi.ScriptUpdateResH\x00R\x0fscriptUpdateResB\x05\n" + - "\x03res\"I\n" + - "\aInfoRes\x12!\n" + - "\fdataspace_id\x18\x01 \x03(\tR\vdataspaceId\x12\x1b\n" + + "\x03res\"1\n" + + "\tDataSpace\x12\x10\n" + + "\x03did\x18\x01 \x03(\tR\x03did\x12\x12\n" + + "\x04wuid\x18\x02 \x03(\tR\x04wuid\"X\n" + + "\aInfoRes\x120\n" + + "\tdataspace\x18\x01 \x01(\v2\x12.saasapi.DataSpaceR\tdataspace\x12\x1b\n" + "\ttarget_id\x18\x02 \x03(\tR\btargetId\"\x82\x01\n" + "\aReadRes\x12$\n" + "\x0esucc_cmd_count\x18\x01 \x01(\rR\fsuccCmdCount\x12$\n" + @@ -3224,11 +3335,17 @@ const file_cmd_proto_rawDesc = "" + "\aSUCCESS\x10\x04\x12\b\n" + "\x04FAIL\x10\x05\x12\v\n" + "\aDELETED\x10\n" + - "*'\n" + - "\x02OS\x12\v\n" + - "\aUNKNOWN\x10\x00\x12\a\n" + + "**\n" + + "\x02OS\x12\x0e\n" + + "\n" + + "OS_UNKNOWN\x10\x00\x12\a\n" + "\x03IOS\x10\x01\x12\v\n" + - "\aANDROID\x10\x02B Z\x1egit.algo.com.cn/public/saasapib\x06proto3" + "\aANDROID\x10\x02*1\n" + + "\x03MAX\x12\x0f\n" + + "\vMAX_UNKNOWN\x10\x00\x12\x06\n" + + "\x02U8\x10@\x12\a\n" + + "\x03U32\x10\b\x12\b\n" + + "\x04FLAG\x10\x04B Z\x1egit.algo.com.cn/public/saasapib\x06proto3" var ( file_cmd_proto_rawDescOnce sync.Once @@ -3242,8 +3359,8 @@ func file_cmd_proto_rawDescGZIP() []byte { return file_cmd_proto_rawDescData } -var file_cmd_proto_enumTypes = make([]protoimpl.EnumInfo, 6) -var file_cmd_proto_msgTypes = make([]protoimpl.MessageInfo, 38) +var file_cmd_proto_enumTypes = make([]protoimpl.EnumInfo, 7) +var file_cmd_proto_msgTypes = make([]protoimpl.MessageInfo, 39) var file_cmd_proto_goTypes = []any{ (BindType)(0), // 0: saasapi.BindType (BindSourceType)(0), // 1: saasapi.BindSourceType @@ -3251,106 +3368,109 @@ var file_cmd_proto_goTypes = []any{ (CmdErrorCode)(0), // 3: saasapi.CmdErrorCode (TaskStatus)(0), // 4: saasapi.TaskStatus (OS)(0), // 5: saasapi.OS - (*SaasReq)(nil), // 6: saasapi.SaasReq - (*Info)(nil), // 7: saasapi.Info - (*Read)(nil), // 8: saasapi.Read - (*ReadItem)(nil), // 9: saasapi.ReadItem - (*Write)(nil), // 10: saasapi.Write - (*WriteItem)(nil), // 11: saasapi.WriteItem - (*Bytes)(nil), // 12: saasapi.Bytes - (*Uint32S)(nil), // 13: saasapi.Uint32s - (*FlagsWithExpire)(nil), // 14: saasapi.FlagsWithExpire - (*FlagWithExpire)(nil), // 15: saasapi.FlagWithExpire - (*ColumnWrite)(nil), // 16: saasapi.ColumnWrite - (*Task)(nil), // 17: saasapi.Task - (*TaskList)(nil), // 18: saasapi.TaskList - (*TaskRun)(nil), // 19: saasapi.TaskRun - (*TaskDelete)(nil), // 20: saasapi.TaskDelete - (*TaskInfo)(nil), // 21: saasapi.TaskInfo - (*FileInfo)(nil), // 22: saasapi.FileInfo - (*FileBlock)(nil), // 23: saasapi.FileBlock - (*TargetList)(nil), // 24: saasapi.TargetList - (*BindSet)(nil), // 25: saasapi.BindSet - (*BindDelete)(nil), // 26: saasapi.BindDelete - (*ScriptRun)(nil), // 27: saasapi.ScriptRun - (*ScriptUpdate)(nil), // 28: saasapi.ScriptUpdate - (*SaasRes)(nil), // 29: saasapi.SaasRes - (*InfoRes)(nil), // 30: saasapi.InfoRes - (*ReadRes)(nil), // 31: saasapi.ReadRes - (*WriteRes)(nil), // 32: saasapi.WriteRes - (*ValueItem)(nil), // 33: saasapi.ValueItem - (*TaskListRes)(nil), // 34: saasapi.TaskListRes - (*TargetListRes)(nil), // 35: saasapi.TargetListRes - (*Binds)(nil), // 36: saasapi.Binds - (*Bind)(nil), // 37: saasapi.Bind - (*BindSetRes)(nil), // 38: saasapi.BindSetRes - (*BindDeleteRes)(nil), // 39: saasapi.BindDeleteRes - (*BindError)(nil), // 40: saasapi.BindError - (*ScriptRunRes)(nil), // 41: saasapi.ScriptRunRes - (*ScriptUpdateRes)(nil), // 42: saasapi.ScriptUpdateRes - nil, // 43: saasapi.TargetListRes.TargetListEntry + (MAX)(0), // 6: saasapi.MAX + (*SaasReq)(nil), // 7: saasapi.SaasReq + (*Info)(nil), // 8: saasapi.Info + (*Read)(nil), // 9: saasapi.Read + (*ReadItem)(nil), // 10: saasapi.ReadItem + (*Write)(nil), // 11: saasapi.Write + (*WriteItem)(nil), // 12: saasapi.WriteItem + (*Bytes)(nil), // 13: saasapi.Bytes + (*Uint32S)(nil), // 14: saasapi.Uint32s + (*FlagsWithExpire)(nil), // 15: saasapi.FlagsWithExpire + (*FlagWithExpire)(nil), // 16: saasapi.FlagWithExpire + (*ColumnWrite)(nil), // 17: saasapi.ColumnWrite + (*Task)(nil), // 18: saasapi.Task + (*TaskList)(nil), // 19: saasapi.TaskList + (*TaskRun)(nil), // 20: saasapi.TaskRun + (*TaskDelete)(nil), // 21: saasapi.TaskDelete + (*TaskInfo)(nil), // 22: saasapi.TaskInfo + (*FileInfo)(nil), // 23: saasapi.FileInfo + (*FileBlock)(nil), // 24: saasapi.FileBlock + (*TargetList)(nil), // 25: saasapi.TargetList + (*BindSet)(nil), // 26: saasapi.BindSet + (*BindDelete)(nil), // 27: saasapi.BindDelete + (*ScriptRun)(nil), // 28: saasapi.ScriptRun + (*ScriptUpdate)(nil), // 29: saasapi.ScriptUpdate + (*SaasRes)(nil), // 30: saasapi.SaasRes + (*DataSpace)(nil), // 31: saasapi.DataSpace + (*InfoRes)(nil), // 32: saasapi.InfoRes + (*ReadRes)(nil), // 33: saasapi.ReadRes + (*WriteRes)(nil), // 34: saasapi.WriteRes + (*ValueItem)(nil), // 35: saasapi.ValueItem + (*TaskListRes)(nil), // 36: saasapi.TaskListRes + (*TargetListRes)(nil), // 37: saasapi.TargetListRes + (*Binds)(nil), // 38: saasapi.Binds + (*Bind)(nil), // 39: saasapi.Bind + (*BindSetRes)(nil), // 40: saasapi.BindSetRes + (*BindDeleteRes)(nil), // 41: saasapi.BindDeleteRes + (*BindError)(nil), // 42: saasapi.BindError + (*ScriptRunRes)(nil), // 43: saasapi.ScriptRunRes + (*ScriptUpdateRes)(nil), // 44: saasapi.ScriptUpdateRes + nil, // 45: saasapi.TargetListRes.TargetListEntry } var file_cmd_proto_depIdxs = []int32{ - 7, // 0: saasapi.SaasReq.info:type_name -> saasapi.Info - 8, // 1: saasapi.SaasReq.read:type_name -> saasapi.Read - 10, // 2: saasapi.SaasReq.write:type_name -> saasapi.Write - 16, // 3: saasapi.SaasReq.column_write:type_name -> saasapi.ColumnWrite - 17, // 4: saasapi.SaasReq.task_create:type_name -> saasapi.Task - 18, // 5: saasapi.SaasReq.task_list:type_name -> saasapi.TaskList - 19, // 6: saasapi.SaasReq.task_run:type_name -> saasapi.TaskRun - 20, // 7: saasapi.SaasReq.task_delete:type_name -> saasapi.TaskDelete - 21, // 8: saasapi.SaasReq.task_info:type_name -> saasapi.TaskInfo - 24, // 9: saasapi.SaasReq.target_list:type_name -> saasapi.TargetList - 25, // 10: saasapi.SaasReq.bind_set:type_name -> saasapi.BindSet - 26, // 11: saasapi.SaasReq.bind_delete:type_name -> saasapi.BindDelete - 27, // 12: saasapi.SaasReq.script_run:type_name -> saasapi.ScriptRun - 28, // 13: saasapi.SaasReq.script_update:type_name -> saasapi.ScriptUpdate - 9, // 14: saasapi.Read.read_items:type_name -> saasapi.ReadItem - 11, // 15: saasapi.Write.write_items:type_name -> saasapi.WriteItem - 12, // 16: saasapi.WriteItem.write_bytes:type_name -> saasapi.Bytes - 13, // 17: saasapi.WriteItem.write_uint32s:type_name -> saasapi.Uint32s - 14, // 18: saasapi.WriteItem.write_flags_with_expire:type_name -> saasapi.FlagsWithExpire - 15, // 19: saasapi.FlagsWithExpire.flags_with_expire:type_name -> saasapi.FlagWithExpire - 12, // 20: saasapi.ColumnWrite.write_bytes:type_name -> saasapi.Bytes - 13, // 21: saasapi.ColumnWrite.write_uint32s:type_name -> saasapi.Uint32s - 14, // 22: saasapi.ColumnWrite.write_flags_with_expire:type_name -> saasapi.FlagsWithExpire - 22, // 23: saasapi.Task.task_file_infos:type_name -> saasapi.FileInfo + 8, // 0: saasapi.SaasReq.info:type_name -> saasapi.Info + 9, // 1: saasapi.SaasReq.read:type_name -> saasapi.Read + 11, // 2: saasapi.SaasReq.write:type_name -> saasapi.Write + 17, // 3: saasapi.SaasReq.column_write:type_name -> saasapi.ColumnWrite + 18, // 4: saasapi.SaasReq.task_create:type_name -> saasapi.Task + 19, // 5: saasapi.SaasReq.task_list:type_name -> saasapi.TaskList + 20, // 6: saasapi.SaasReq.task_run:type_name -> saasapi.TaskRun + 21, // 7: saasapi.SaasReq.task_delete:type_name -> saasapi.TaskDelete + 22, // 8: saasapi.SaasReq.task_info:type_name -> saasapi.TaskInfo + 25, // 9: saasapi.SaasReq.target_list:type_name -> saasapi.TargetList + 26, // 10: saasapi.SaasReq.bind_set:type_name -> saasapi.BindSet + 27, // 11: saasapi.SaasReq.bind_delete:type_name -> saasapi.BindDelete + 28, // 12: saasapi.SaasReq.script_run:type_name -> saasapi.ScriptRun + 29, // 13: saasapi.SaasReq.script_update:type_name -> saasapi.ScriptUpdate + 10, // 14: saasapi.Read.read_items:type_name -> saasapi.ReadItem + 12, // 15: saasapi.Write.write_items:type_name -> saasapi.WriteItem + 13, // 16: saasapi.WriteItem.write_bytes:type_name -> saasapi.Bytes + 14, // 17: saasapi.WriteItem.write_uint32s:type_name -> saasapi.Uint32s + 15, // 18: saasapi.WriteItem.write_flags_with_expire:type_name -> saasapi.FlagsWithExpire + 16, // 19: saasapi.FlagsWithExpire.flags_with_expire:type_name -> saasapi.FlagWithExpire + 13, // 20: saasapi.ColumnWrite.write_bytes:type_name -> saasapi.Bytes + 14, // 21: saasapi.ColumnWrite.write_uint32s:type_name -> saasapi.Uint32s + 15, // 22: saasapi.ColumnWrite.write_flags_with_expire:type_name -> saasapi.FlagsWithExpire + 23, // 23: saasapi.Task.task_file_infos:type_name -> saasapi.FileInfo 4, // 24: saasapi.Task.status:type_name -> saasapi.TaskStatus 4, // 25: saasapi.TaskList.status_filter:type_name -> saasapi.TaskStatus - 23, // 26: saasapi.FileInfo.file_blocks:type_name -> saasapi.FileBlock - 37, // 27: saasapi.BindSet.binds:type_name -> saasapi.Bind - 37, // 28: saasapi.BindDelete.binds:type_name -> saasapi.Bind + 24, // 26: saasapi.FileInfo.file_blocks:type_name -> saasapi.FileBlock + 39, // 27: saasapi.BindSet.binds:type_name -> saasapi.Bind + 39, // 28: saasapi.BindDelete.binds:type_name -> saasapi.Bind 5, // 29: saasapi.ScriptRun.os:type_name -> saasapi.OS 2, // 30: saasapi.SaasRes.code:type_name -> saasapi.ErrorCode - 30, // 31: saasapi.SaasRes.info_res:type_name -> saasapi.InfoRes - 31, // 32: saasapi.SaasRes.read_res:type_name -> saasapi.ReadRes - 32, // 33: saasapi.SaasRes.write_res:type_name -> saasapi.WriteRes - 17, // 34: saasapi.SaasRes.task_create_res:type_name -> saasapi.Task - 34, // 35: saasapi.SaasRes.task_list_res:type_name -> saasapi.TaskListRes - 17, // 36: saasapi.SaasRes.task_run_res:type_name -> saasapi.Task - 17, // 37: saasapi.SaasRes.task_delete_res:type_name -> saasapi.Task - 17, // 38: saasapi.SaasRes.task_info_res:type_name -> saasapi.Task - 35, // 39: saasapi.SaasRes.target_list_res:type_name -> saasapi.TargetListRes - 38, // 40: saasapi.SaasRes.bind_set_res:type_name -> saasapi.BindSetRes - 39, // 41: saasapi.SaasRes.bind_delete_res:type_name -> saasapi.BindDeleteRes - 41, // 42: saasapi.SaasRes.script_run_res:type_name -> saasapi.ScriptRunRes - 42, // 43: saasapi.SaasRes.script_update_res:type_name -> saasapi.ScriptUpdateRes - 33, // 44: saasapi.ReadRes.cmd_res:type_name -> saasapi.ValueItem - 3, // 45: saasapi.ValueItem.cmd_code:type_name -> saasapi.CmdErrorCode - 15, // 46: saasapi.ValueItem.flags_with_expire:type_name -> saasapi.FlagWithExpire - 17, // 47: saasapi.TaskListRes.tasks:type_name -> saasapi.Task - 43, // 48: saasapi.TargetListRes.target_list:type_name -> saasapi.TargetListRes.TargetListEntry - 37, // 49: saasapi.Binds.binds:type_name -> saasapi.Bind - 0, // 50: saasapi.Bind.bind_type:type_name -> saasapi.BindType - 1, // 51: saasapi.Bind.bind_source:type_name -> saasapi.BindSourceType - 40, // 52: saasapi.BindSetRes.errors:type_name -> saasapi.BindError - 40, // 53: saasapi.BindDeleteRes.errors:type_name -> saasapi.BindError - 36, // 54: saasapi.TargetListRes.TargetListEntry.value:type_name -> saasapi.Binds - 55, // [55:55] is the sub-list for method output_type - 55, // [55:55] is the sub-list for method input_type - 55, // [55:55] is the sub-list for extension type_name - 55, // [55:55] is the sub-list for extension extendee - 0, // [0:55] is the sub-list for field type_name + 32, // 31: saasapi.SaasRes.info_res:type_name -> saasapi.InfoRes + 33, // 32: saasapi.SaasRes.read_res:type_name -> saasapi.ReadRes + 34, // 33: saasapi.SaasRes.write_res:type_name -> saasapi.WriteRes + 18, // 34: saasapi.SaasRes.task_create_res:type_name -> saasapi.Task + 36, // 35: saasapi.SaasRes.task_list_res:type_name -> saasapi.TaskListRes + 18, // 36: saasapi.SaasRes.task_run_res:type_name -> saasapi.Task + 18, // 37: saasapi.SaasRes.task_delete_res:type_name -> saasapi.Task + 18, // 38: saasapi.SaasRes.task_info_res:type_name -> saasapi.Task + 37, // 39: saasapi.SaasRes.target_list_res:type_name -> saasapi.TargetListRes + 40, // 40: saasapi.SaasRes.bind_set_res:type_name -> saasapi.BindSetRes + 41, // 41: saasapi.SaasRes.bind_delete_res:type_name -> saasapi.BindDeleteRes + 43, // 42: saasapi.SaasRes.script_run_res:type_name -> saasapi.ScriptRunRes + 44, // 43: saasapi.SaasRes.script_update_res:type_name -> saasapi.ScriptUpdateRes + 31, // 44: saasapi.InfoRes.dataspace:type_name -> saasapi.DataSpace + 35, // 45: saasapi.ReadRes.cmd_res:type_name -> saasapi.ValueItem + 3, // 46: saasapi.ValueItem.cmd_code:type_name -> saasapi.CmdErrorCode + 16, // 47: saasapi.ValueItem.flags_with_expire:type_name -> saasapi.FlagWithExpire + 18, // 48: saasapi.TaskListRes.tasks:type_name -> saasapi.Task + 45, // 49: saasapi.TargetListRes.target_list:type_name -> saasapi.TargetListRes.TargetListEntry + 39, // 50: saasapi.Binds.binds:type_name -> saasapi.Bind + 0, // 51: saasapi.Bind.bind_type:type_name -> saasapi.BindType + 1, // 52: saasapi.Bind.bind_source:type_name -> saasapi.BindSourceType + 42, // 53: saasapi.BindSetRes.errors:type_name -> saasapi.BindError + 42, // 54: saasapi.BindDeleteRes.errors:type_name -> saasapi.BindError + 38, // 55: saasapi.TargetListRes.TargetListEntry.value:type_name -> saasapi.Binds + 56, // [56:56] is the sub-list for method output_type + 56, // [56:56] is the sub-list for method input_type + 56, // [56:56] is the sub-list for extension type_name + 56, // [56:56] is the sub-list for extension extendee + 0, // [0:56] is the sub-list for field type_name } func init() { file_cmd_proto_init() } @@ -3394,8 +3514,8 @@ func file_cmd_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_cmd_proto_rawDesc), len(file_cmd_proto_rawDesc)), - NumEnums: 6, - NumMessages: 38, + NumEnums: 7, + NumMessages: 39, NumExtensions: 0, NumServices: 0, }, diff --git a/cmd.proto b/cmd.proto index abebfaa..7b32111 100644 --- a/cmd.proto +++ b/cmd.proto @@ -66,20 +66,20 @@ message WriteItem { message Bytes { bytes bytes = 1; // 写入的byte uint64 index_1 = 2; // 写入byte的索引值(0..63) - uint64 index_2 = 3; // 写入byte的索引值(64..127) + uint64 index_2 = 3 [deprecated=true]; // **已弃用 写入byte的索引值(64..127) } // Uint32s 写入uint32区域 message Uint32s { repeated uint32 uint32s = 1; // 写入的uint32 - uint64 index_1 = 2; // 写入uint32的索引值(0..15) 最多 16 个 + uint64 index_1 = 2; // 写入uint32的索引值(0..7) 最多 8 个 //uint64 index_2 = 3; // 写入uint32的索引值(当前不支持) } // FlagsWithExpire 写入标志位区域 message FlagsWithExpire { repeated FlagWithExpire flags_with_expire = 1; // 写入的标志位 - uint64 index_1 = 2; // 写入标志位的索引值 + uint64 index_1 = 2; // 写入标志位的索引值(0..3) 最多 4 个 } // FlagWithExpire 标志位 @@ -205,9 +205,14 @@ message SaasRes { } } +message DataSpace { + repeated string did = 1; // 设备ID区 + repeated string wuid = 2; // OpenID区 +} + // InfoRes 账号信息返回 message InfoRes { - repeated string dataspace_id = 1; // 可用数据区列表 + DataSpace dataspace = 1; // 可用数据区列表 repeated string target_id = 2; // 策略ID列表 } @@ -349,6 +354,7 @@ enum CmdErrorCode { OK = 0; // 成功 } +// TaskStatus 任务状态 enum TaskStatus { ALL = 0; // 全部 WAITING = 1; // 等待中 @@ -361,8 +367,16 @@ enum TaskStatus { } enum OS { - UNKNOWN = 0; + OS_UNKNOWN = 0; IOS = 1; ANDROID = 2; } +// MAX 最大限定 +enum MAX { + MAX_UNKNOWN = 0; + U8 = 64; + U32 = 8; + FLAG = 4; +} + diff --git a/cmd/saastool/convert.go b/cmd/saastool/convert.go index 8837512..64d24e7 100644 --- a/cmd/saastool/convert.go +++ b/cmd/saastool/convert.go @@ -236,11 +236,7 @@ func convertBatch(lines []string, convertParams convertParams, resultChan chan<- saasWriteItem.WriteBytes = &saasapi.Bytes{} } saasWriteItem.WriteBytes.Bytes = append(saasWriteItem.WriteBytes.Bytes, *targetinfo.WriteByte) - if targetinfo.WriteBytePos < 64 { - saasWriteItem.WriteBytes.Index_1 |= 1 << targetinfo.WriteBytePos - } else if targetinfo.WriteBytePos < 128 { - saasWriteItem.WriteBytes.Index_2 |= 1 << (targetinfo.WriteBytePos - 64) - } + saasWriteItem.WriteBytes.Index_1 |= 1 << targetinfo.WriteBytePos } if targetinfo.WriteUint32 != nil { diff --git a/cmd/saastool/convert_cfg.go b/cmd/saastool/convert_cfg.go new file mode 100644 index 0000000..d8a4e30 --- /dev/null +++ b/cmd/saastool/convert_cfg.go @@ -0,0 +1,61 @@ +package main + +import ( + "encoding/json" + "fmt" + "os" + + "git.algo.com.cn/public/saasapi" +) + +// MapConfig 配置 +type MapConfig struct { + Targets map[string]*Target `json:"targets"` +} + +// Target 配置 +type Target struct { + WriteByte *byte `json:"write_byte"` // byte值 + WriteBytePos uint32 `json:"write_byte_pos"` // byte写入位置 + WriteUint32 *uint32 `json:"write_uint32"` // uint32值 + WriteUint32Pos uint32 `json:"write_uint32_pos"` // uint32写入位置 + WriteFlag *bool `json:"write_flag"` // 标志位 + WriteExpire *uint32 `json:"write_expire"` // 过期时间 + WriteFlagWithExpirePos uint32 `json:"write_flag_with_expire_pos"` // 标志与过期写入位置 + +} + +// LoadConfigFile 加载配置文件 +func LoadMapFile(filename string) (*MapConfig, error) { + // 打开文件 + f, err := os.Open(filename) + if err != nil { + return nil, err + } + defer f.Close() + + sc := &MapConfig{} + + err = json.NewDecoder(f).Decode(sc) + + if err != nil { + return nil, err + } + + for targetName, targetInfo := range sc.Targets { + if targetInfo.WriteBytePos >= uint32(saasapi.MAX_U8) { + err = fmt.Errorf("%v WriteBytePos>MAX_U8 , current %v, MAX %v", targetName, targetInfo.WriteBytePos, uint32(saasapi.MAX_U8)-1) + break + } + if targetInfo.WriteUint32Pos >= uint32(saasapi.MAX_U32) { + err = fmt.Errorf("%v WriteUint32Pos>MAX_U32 , current %v, MAX %v", targetName, targetInfo.WriteUint32Pos, uint32(saasapi.MAX_U32)-1) + break + } + if targetInfo.WriteFlagWithExpirePos >= uint32(saasapi.MAX_FLAG) { + err = fmt.Errorf("%v WriteFlagWithExpirePos>MAX_FLAG , current %v, MAX %v", targetName, targetInfo.WriteFlagWithExpirePos, uint32(saasapi.MAX_FLAG)-1) + break + } + } + + return sc, err +} diff --git a/cmd/saastool/target_cfg.go b/cmd/saastool/target_cfg.go deleted file mode 100644 index 6172c38..0000000 --- a/cmd/saastool/target_cfg.go +++ /dev/null @@ -1,38 +0,0 @@ -package main - -import ( - "encoding/json" - "os" -) - -// MapConfig 配置 -type MapConfig struct { - Targets map[string]*Target `json:"targets"` -} - -// Target 配置 -type Target struct { - WriteByte *byte `json:"write_byte"` // byte值 - WriteBytePos int `json:"write_byte_pos"` // byte写入位置 - WriteUint32 *uint32 `json:"write_uint32"` // uint32值 - WriteUint32Pos int `json:"write_uint32_pos"` // uint32写入位置 - WriteFlag *bool `json:"write_flag"` // 标志位 - WriteExpire *uint32 `json:"write_expire"` // 过期时间 - WriteFlagWithExpirePos int `json:"write_flag_with_expire_pos"` // 标志与过期写入位置 - -} - -// LoadConfigFile 加载配置文件 -func LoadMapFile(filename string) (*MapConfig, error) { - // 打开文件 - f, err := os.Open(filename) - if err != nil { - return nil, err - } - defer f.Close() - - sc := &MapConfig{} - - err = json.NewDecoder(f).Decode(sc) - return sc, err -} diff --git a/cmd/saastool/task_info.go b/cmd/saastool/task_info.go index f5fa694..8bbeddd 100644 --- a/cmd/saastool/task_info.go +++ b/cmd/saastool/task_info.go @@ -17,7 +17,7 @@ type infoTaskParams struct { } func RunTaskInfo(args ...string) error { - fs := flag.NewFlagSet("create", flag.ExitOnError) + fs := flag.NewFlagSet("info", flag.ExitOnError) cfgFile := paramConfig(fs) sha256 := paramSha256(fs) diff --git a/cmd/saastool/task_list.go b/cmd/saastool/task_list.go index bf800e9..7a2d936 100644 --- a/cmd/saastool/task_list.go +++ b/cmd/saastool/task_list.go @@ -17,7 +17,7 @@ type listTaskParams struct { } func RunTaskList(args ...string) error { - fs := flag.NewFlagSet("create", flag.ExitOnError) + fs := flag.NewFlagSet("list", flag.ExitOnError) cfgFile := paramConfig(fs) filter := paramFilterStatus(fs) diff --git a/cmd/saastool/task_run.go b/cmd/saastool/task_run.go index 779f825..6805db3 100644 --- a/cmd/saastool/task_run.go +++ b/cmd/saastool/task_run.go @@ -17,7 +17,7 @@ type runTaskParams struct { } func RunTaskRun(args ...string) error { - fs := flag.NewFlagSet("create", flag.ExitOnError) + fs := flag.NewFlagSet("run", flag.ExitOnError) cfgFile := paramConfig(fs) sha256 := paramSha256(fs)