1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00

update proto

This commit is contained in:
wdvxdr 2021-06-11 13:27:01 +08:00
parent 2233f43953
commit d4b216a0ed
No known key found for this signature in database
GPG Key ID: 55FF1414A69CEBA6
7 changed files with 483 additions and 1525 deletions

View File

@ -7,6 +7,8 @@ import (
"math/rand"
"time"
"github.com/golang/protobuf/proto"
"github.com/Mrs4s/MiraiGo/binary"
"github.com/Mrs4s/MiraiGo/binary/jce"
"github.com/Mrs4s/MiraiGo/client/pb"
@ -20,7 +22,6 @@ import (
"github.com/Mrs4s/MiraiGo/protocol/crypto"
"github.com/Mrs4s/MiraiGo/protocol/packets"
"github.com/Mrs4s/MiraiGo/protocol/tlv"
"github.com/golang/protobuf/proto"
)
var (
@ -821,22 +822,22 @@ func (c *QQClient) buildDeleteOnlinePushPacket(uin int64, svrip int32, pushToken
func (c *QQClient) buildOffPicUpPacket(target int64, md5 []byte, size int32) (uint16, []byte) {
seq := c.nextSeq()
req := &cmd0x352.ReqBody{
Subcmd: 1,
MsgTryupImgReq: []*cmd0x352.D352TryUpImgReq{
Subcmd: proto.Uint32(1),
TryupImgReq: []*cmd0x352.D352TryUpImgReq{
{
SrcUin: int32(c.Uin),
DstUin: int32(target),
SrcUin: proto.Uint64(uint64(c.Uin)),
DstUin: proto.Uint64(uint64(target)),
FileMd5: md5,
FileSize: size,
Filename: hex.EncodeToString(md5) + ".jpg",
SrcTerm: 5,
PlatformType: 9,
BuType: 1,
ImgOriginal: 1,
ImgType: 1000,
BuildVer: "8.2.7.4410",
FileSize: proto.Uint64(uint64(size)),
FileName: []byte(hex.EncodeToString(md5) + ".jpg"),
SrcTerm: proto.Uint32(5),
PlatformType: proto.Uint32(9),
BuType: proto.Uint32(1),
PicOriginal: proto.Bool(true),
PicType: proto.Uint32(1000),
BuildVer: []byte("8.2.7.4410"),
FileIndex: EmptyBytes,
SrvUpload: 1,
SrvUpload: proto.Uint32(1),
TransferUrl: EmptyBytes,
},
},

View File

@ -10,6 +10,9 @@ import (
"sync"
"time"
"github.com/golang/protobuf/proto"
"github.com/pkg/errors"
"github.com/Mrs4s/MiraiGo/binary"
"github.com/Mrs4s/MiraiGo/binary/jce"
"github.com/Mrs4s/MiraiGo/client/pb"
@ -21,8 +24,6 @@ import (
"github.com/Mrs4s/MiraiGo/client/pb/qweb"
"github.com/Mrs4s/MiraiGo/client/pb/structmsg"
"github.com/Mrs4s/MiraiGo/utils"
"github.com/golang/protobuf/proto"
"github.com/pkg/errors"
)
var (
@ -603,35 +604,35 @@ func decodeOffPicUpResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte)
if err := proto.Unmarshal(payload, &rsp); err != nil {
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
}
if rsp.FailMsg != "" {
if rsp.GetFailMsg() != nil {
return imageUploadResponse{
ResultCode: -1,
Message: rsp.FailMsg,
Message: string(rsp.FailMsg),
}, nil
}
if rsp.Subcmd != 1 || len(rsp.MsgTryupImgRsp) == 0 {
if rsp.GetSubcmd() != 1 || len(rsp.GetTryupImgRsp()) == 0 {
return imageUploadResponse{
ResultCode: -2,
}, nil
}
imgRsp := rsp.MsgTryupImgRsp[0]
if imgRsp.Result != 0 {
imgRsp := rsp.GetTryupImgRsp()[0]
if imgRsp.GetResult() != 0 {
return imageUploadResponse{
ResultCode: imgRsp.Result,
Message: imgRsp.FailMsg,
ResultCode: int32(*imgRsp.Result),
Message: string(imgRsp.GetFailMsg()),
}, nil
}
if imgRsp.BoolFileExit {
if imgRsp.GetFileExit() {
return imageUploadResponse{
IsExists: true,
ResourceId: imgRsp.UpResid,
ResourceId: string(imgRsp.GetUpResid()),
}, nil
}
return imageUploadResponse{
ResourceId: imgRsp.UpResid,
UploadKey: imgRsp.UpUkey,
UploadIp: imgRsp.Uint32UpIp,
UploadPort: imgRsp.Uint32UpPort,
ResourceId: string(imgRsp.GetUpResid()),
UploadKey: imgRsp.GetUpUkey(),
UploadIp: imgRsp.GetUpIp(),
UploadPort: imgRsp.GetUpPort(),
}, nil
}

View File

@ -1,9 +1,10 @@
package client
import (
"github.com/pkg/errors"
"github.com/Mrs4s/MiraiGo/binary/jce"
"github.com/Mrs4s/MiraiGo/message"
"github.com/pkg/errors"
)
var (
@ -248,8 +249,8 @@ type (
imageUploadResponse struct {
UploadKey []byte
UploadIp []int32
UploadPort []int32
UploadIp []uint32
UploadPort []uint32
ResourceId string
Message string
FileId int64

File diff suppressed because it is too large Load Diff

View File

@ -1,143 +1,145 @@
syntax = "proto3";
option go_package = ".;cmd0x352";
syntax = "proto2";
option go_package = "./;cmd0x352";
/*
message DelImgReq {
int64 srcUin = 1;
int64 dstUin = 2;
int32 reqTerm = 3;
int32 reqPlatformType = 4;
int32 buType = 5;
bytes buildVer = 6;
bytes fileResid = 7;
int32 picWidth = 8;
int32 picHeight = 9;
optional uint64 srcUin = 1;
optional uint64 dstUin = 2;
optional uint32 reqTerm = 3;
optional uint32 reqPlatformType = 4;
optional uint32 buType = 5;
optional bytes buildVer = 6;
optional bytes fileResid = 7;
optional uint32 picWidth = 8;
optional uint32 picHeight = 9;
}
message DelImgRsp {
int32 result = 1;
bytes failMsg = 2;
bytes fileResid = 3;
optional uint32 result = 1;
optional bytes failMsg = 2;
optional bytes fileResid = 3;
}
message GetImgUrlReq {
int64 srcUin = 1;
int64 dstUin = 2;
bytes fileResid = 3;
int32 urlFlag = 4;
int32 urlType = 6;
int32 reqTerm = 7;
int32 reqPlatformType = 8;
int32 srcFileType = 9;
int32 innerIp = 10;
bool boolAddressBook = 11;
int32 buType = 12;
bytes buildVer = 13;
int32 picUpTimestamp = 14;
int32 reqTransferType = 15;
optional uint64 srcUin = 1;
optional uint64 dstUin = 2;
optional bytes fileResid = 3;
optional uint32 urlFlag = 4;
optional uint32 urlType = 6;
optional uint32 reqTerm = 7;
optional uint32 reqPlatformType = 8;
optional uint32 srcFileType = 9;
optional uint32 innerIp = 10;
optional bool addressBook = 11;
optional uint32 buType = 12;
optional bytes buildVer = 13;
optional uint32 picUpTimestamp = 14;
optional uint32 reqTransferType = 15;
}
message GetImgUrlRsp {
bytes fileResid = 1;
int32 clientIp = 2;
int32 result = 3;
bytes failMsg = 4;
bytes bytesThumbDownUrl = 5;
bytes bytesOriginalDownUrl = 6;
D352ImgInfo msgImgInfo = 7;
repeated int32 uint32DownIp = 8;
repeated int32 uint32DownPort = 9;
bytes thumbDownPara = 10;
bytes originalDownPara = 11;
bytes downDomain = 12;
bytes bytesBigDownUrl = 13;
bytes bigDownPara = 14;
bytes bigThumbDownPara = 15;
int32 httpsUrlFlag = 16;
repeated IPv6Info msgDownIp6 = 26;
bytes clientIp6 = 27;
}
message D352ImgInfo {
bytes fileMd5 = 1;
int32 fileType = 2;
int64 fileSize = 3;
int32 fileWidth = 4;
int32 fileHeight = 5;
int64 fileFlag = 6;
int32 fileCutPos = 7;
optional bytes fileResid = 1;
optional uint32 clientIp = 2;
optional uint32 result = 3;
optional bytes failMsg = 4;
repeated bytes thumbDownUrl = 5;
repeated bytes originalDownUrl = 6;
optional ImgInfo imgInfo = 7;
repeated uint32 downIp = 8;
repeated uint32 downPort = 9;
optional bytes thumbDownPara = 10;
optional bytes originalDownPara = 11;
optional bytes downDomain = 12;
repeated bytes bigDownUrl = 13;
optional bytes bigDownPara = 14;
optional bytes bigThumbDownPara = 15;
optional uint32 httpsUrlFlag = 16;
repeated IPv6Info downIp6 = 26;
optional bytes clientIp6 = 27;
}
message IPv6Info {
bytes ip6 = 1;
int32 port = 2;
optional bytes ip6 = 1;
optional uint32 port = 2;
}
*/
message ReqBody {
int32 subcmd = 1;
repeated D352TryUpImgReq msgTryupImgReq = 2;
repeated GetImgUrlReq msgGetimgUrlReq = 3;
repeated DelImgReq msgDelImgReq = 4;
int32 netType = 10;
optional uint32 subcmd = 1;
repeated D352TryUpImgReq tryupImgReq = 2;
// repeated GetImgUrlReq getimgUrlReq = 3;
// repeated DelImgReq delImgReq = 4;
optional uint32 netType = 10;
}
message RspBody {
int32 subcmd = 1;
repeated TryUpImgRsp msgTryupImgRsp = 2;
repeated GetImgUrlRsp msgGetimgUrlRsp = 3;
bool boolNewBigchan = 4;
repeated DelImgRsp msgDelImgRsp = 5;
string failMsg = 10;
optional uint32 subcmd = 1;
repeated TryUpImgRsp tryupImgRsp = 2;
// repeated GetImgUrlRsp getimgUrlRsp = 3;
optional bool newBigchan = 4;
// repeated DelImgRsp delImgRsp = 5;
optional bytes failMsg = 10;
}
message D352TryUpImgReq {
int32 srcUin = 1;
int32 dstUin = 2;
int32 fileId = 3;
bytes fileMd5 = 4;
int32 fileSize = 5;
string filename = 6;
int32 srcTerm = 7;
int32 platformType = 8;
int32 innerIP = 9;
int32 addressBook = 10;
int32 retry = 11;
int32 buType = 12;
int32 imgOriginal = 13;
int32 imgWidth = 14;
int32 imgHeight = 15;
int32 imgType = 16;
string buildVer = 17;
bytes fileIndex = 18;
int32 fileStoreDays = 19;
int32 stepFlag = 20;
int32 rejectTryFast = 21;
int32 srvUpload = 22;
bytes transferUrl = 23;
optional uint64 srcUin = 1;
optional uint64 dstUin = 2;
optional uint64 fileId = 3;
optional bytes fileMd5 = 4;
optional uint64 fileSize = 5;
optional bytes fileName = 6;
optional uint32 srcTerm = 7;
optional uint32 platformType = 8;
optional uint32 innerIp = 9;
optional bool addressBook = 10;
optional uint32 retry = 11;
optional uint32 buType = 12;
optional bool picOriginal = 13;
optional uint32 picWidth = 14;
optional uint32 picHeight = 15;
optional uint32 picType = 16;
optional bytes buildVer = 17;
optional bytes fileIndex = 18;
optional uint32 storeDays = 19;
optional uint32 tryupStepflag = 20;
optional bool rejectTryfast = 21;
optional uint32 srvUpload = 22;
optional bytes transferUrl = 23;
}
message TryUpImgRsp {
int64 fileId = 1;
int32 clientIp = 2;
int32 result = 3;
string failMsg = 4;
bool boolFileExit = 5;
D352ImgInfo msgImgInfo = 6;
repeated int32 uint32UpIp = 7;
repeated int32 uint32UpPort = 8;
bytes upUkey = 9;
string upResid = 10;
string upUuid = 11;
int64 upOffset = 12;
int64 blockSize = 13;
bytes encryptDstip = 14;
int32 roamdays = 15;
repeated IPv6Info msgUpIp6 = 26;
bytes clientIp6 = 27;
bytes thumbDownPara = 60;
bytes originalDownPara = 61;
bytes downDomain = 62;
bytes bigDownPara = 64;
bytes bigThumbDownPara = 65;
int32 httpsUrlFlag = 66;
TryUpInfo4Busi msgInfo4busi = 1001;
optional uint64 fileId = 1;
optional uint32 clientIp = 2;
optional uint32 result = 3;
optional bytes failMsg = 4;
optional bool fileExit = 5;
// optional ImgInfo imgInfo = 6;
repeated uint32 upIp = 7;
repeated uint32 upPort = 8;
optional bytes upUkey = 9;
optional bytes upResid = 10;
optional bytes upUuid = 11;
optional uint64 upOffset = 12;
optional uint64 blockSize = 13;
optional bytes encryptDstip = 14;
optional uint32 roamdays = 15;
// repeated IPv6Info upIp6 = 26;
optional bytes clientIp6 = 27;
optional bytes thumbDownPara = 60;
optional bytes originalDownPara = 61;
optional bytes downDomain = 62;
optional bytes bigDownPara = 64;
optional bytes bigThumbDownPara = 65;
optional uint32 httpsUrlFlag = 66;
// optional TryUpInfo4Busi info4Busi = 1001;
}
/*
message TryUpInfo4Busi {
bytes fileResid = 1;
bytes downDomain = 2;
bytes thumbDownUrl = 3;
bytes originalDownUrl = 4;
bytes bigDownUrl = 5;
optional bytes fileResid = 1;
optional bytes downDomain = 2;
optional bytes thumbDownUrl = 3;
optional bytes originalDownUrl = 4;
optional bytes bigDownUrl = 5;
}
*/

View File

@ -1,18 +1,16 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.11.4
// protoc-gen-go v1.26.0
// protoc v3.17.1
// source: data.proto
package pb
import (
reflect "reflect"
sync "sync"
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
@ -22,10 +20,6 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type DeviceInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -1490,8 +1484,8 @@ type TryUpImgResp struct {
FailMsg string `protobuf:"bytes,3,opt,name=failMsg,proto3" json:"failMsg,omitempty"`
BoolFileExit bool `protobuf:"varint,4,opt,name=boolFileExit,proto3" json:"boolFileExit,omitempty"`
MsgImgInfo *ImgInfo `protobuf:"bytes,5,opt,name=msgImgInfo,proto3" json:"msgImgInfo,omitempty"`
Uint32UpIp []int32 `protobuf:"varint,6,rep,packed,name=uint32UpIp,proto3" json:"uint32UpIp,omitempty"`
Uint32UpPort []int32 `protobuf:"varint,7,rep,packed,name=uint32UpPort,proto3" json:"uint32UpPort,omitempty"`
Uint32UpIp []uint32 `protobuf:"varint,6,rep,packed,name=uint32UpIp,proto3" json:"uint32UpIp,omitempty"`
Uint32UpPort []uint32 `protobuf:"varint,7,rep,packed,name=uint32UpPort,proto3" json:"uint32UpPort,omitempty"`
UpUkey []byte `protobuf:"bytes,8,opt,name=upUkey,proto3" json:"upUkey,omitempty"`
Fid int64 `protobuf:"varint,9,opt,name=fid,proto3" json:"fid,omitempty"`
}
@ -1563,14 +1557,14 @@ func (x *TryUpImgResp) GetMsgImgInfo() *ImgInfo {
return nil
}
func (x *TryUpImgResp) GetUint32UpIp() []int32 {
func (x *TryUpImgResp) GetUint32UpIp() []uint32 {
if x != nil {
return x.Uint32UpIp
}
return nil
}
func (x *TryUpImgResp) GetUint32UpPort() []int32 {
func (x *TryUpImgResp) GetUint32UpPort() []uint32 {
if x != nil {
return x.Uint32UpPort
}
@ -3545,9 +3539,9 @@ var file_data_proto_rawDesc = []byte{
0x6e, 0x66, 0x6f, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x49, 0x6d, 0x67, 0x49,
0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x6d, 0x73, 0x67, 0x49, 0x6d, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x12,
0x1e, 0x0a, 0x0a, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x55, 0x70, 0x49, 0x70, 0x18, 0x06, 0x20,
0x03, 0x28, 0x05, 0x52, 0x0a, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x55, 0x70, 0x49, 0x70, 0x12,
0x03, 0x28, 0x0d, 0x52, 0x0a, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x55, 0x70, 0x49, 0x70, 0x12,
0x22, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x55, 0x70, 0x50, 0x6f, 0x72, 0x74, 0x18,
0x07, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x55, 0x70, 0x50,
0x07, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x55, 0x70, 0x50,
0x6f, 0x72, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x70, 0x55, 0x6b, 0x65, 0x79, 0x18, 0x08, 0x20,
0x01, 0x28, 0x0c, 0x52, 0x06, 0x75, 0x70, 0x55, 0x6b, 0x65, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x66,
0x69, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x66, 0x69, 0x64, 0x22, 0xc9, 0x03,
@ -3807,8 +3801,8 @@ var file_data_proto_rawDesc = []byte{
0x6d, 0x65, 0x64, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c,
0x18, 0x27, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x14, 0x0a,
0x05, 0x68, 0x6f, 0x6e, 0x6f, 0x72, 0x18, 0x29, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x68, 0x6f,
0x6e, 0x6f, 0x72, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
0x6e, 0x6f, 0x72, 0x42, 0x07, 0x5a, 0x05, 0x2e, 0x2f, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -1,6 +1,6 @@
syntax = "proto3";
option go_package = ".;pb";
option go_package = "./;pb";
message DeviceInfo {
@ -170,8 +170,8 @@ message TryUpImgResp {
string failMsg = 3;
bool boolFileExit = 4;
ImgInfo msgImgInfo = 5;
repeated int32 uint32UpIp = 6;
repeated int32 uint32UpPort = 7;
repeated uint32 uint32UpIp = 6;
repeated uint32 uint32UpPort = 7;
bytes upUkey = 8;
int64 fid = 9;
}