feat: proto 整理

This commit is contained in:
手瓜一十雪 committed 2024-10-12 22:25:10 +08:00
1 parent 913193618e
commit 08120d8e1d
13 files changed
+32 -101

No files matched your search

-21
View File
@@ -1,21 +0,0 @@
import { MessageType, BinaryReader, ScalarType, BinaryWriter } from '@protobuf-ts/runtime';
export const FileId = new MessageType("FileId", [
{ no: 2, name: "sha1", kind: "scalar", T: ScalarType.BYTES },
{ no: 4, name: "appid", kind: "scalar", T: ScalarType.UINT32 },
]);
export function encodePBFileId(message: any) {
return FileId.internalBinaryWrite(message, new BinaryWriter(), {
writerFactory: () => new BinaryWriter(),
writeUnknownFields: false
}).finish();
}
export function decodePBFileId(buffer: Uint8Array): any {
const reader = new BinaryReader(buffer);
return FileId.internalBinaryRead(reader, reader.len, {
readUnknownField: true,
readerFactory: () => new BinaryReader(buffer)
});
}
-21
View File
@@ -1,21 +0,0 @@
import { MessageType, ScalarType } from "@protobuf-ts/runtime";
import { OidbSvcTrpcTcpBase } from "./Poke";
export const OidbSvcTrpcTcp0XFE1_2 = new MessageType("oidb_svc_trpctcp_0xfe1_2", [
{ no: 1, name: "uin", kind: "scalar", T: ScalarType.UINT32 },
{ no: 3, name: "key", kind: "scalar", T: ScalarType.BYTES, opt: true }
]);
export function encode_packet_0xfe1_2(PeerUin: string) {
let Body = OidbSvcTrpcTcp0XFE1_2.toBinary
({
uin: parseInt(PeerUin),
key: new Uint8Array([0x00, 0x00, 0x00, 0x00])
});
return OidbSvcTrpcTcpBase.toBinary
({
command: 0xfe1,
subcommand: 2,
body: Body,
isreserved: 1
});
}
-16
View File
@@ -1,16 +0,0 @@
import { ProtoField } from "./NapProto";
import { ScalarType } from '@protobuf-ts/runtime';
export const OidbSvcTrpcTcpBaseProto = {
command: ProtoField(1, ScalarType.UINT32),
subCommand: ProtoField(2, ScalarType.UINT32),
body: ProtoField(4, ScalarType.BYTES),
isReserved: ProtoField(12, ScalarType.UINT32, false, true)
}
export const OidbSvcTrpcTcp0XED3_1 = {
uin: ProtoField(1, ScalarType.UINT32),
groupUin: ProtoField(2, ScalarType.UINT32, false, true),
friendUin: ProtoField(5, ScalarType.BYTES, false, true),
ext: ProtoField(6, ScalarType.UINT32)
}
-31
View File
@@ -1,31 +0,0 @@
// import { MessageType, ScalarType, BinaryWriter } from '@protobuf-ts/runtime';
// export const OidbSvcTrpcTcpBase = new MessageType("oidb_svc_trpctcp_base", [
// { no: 1, name: "command", kind: "scalar", T: ScalarType.UINT32 },
// { no: 2, name: "subcommand", kind: "scalar", T: ScalarType.UINT32, opt: true },
// { no: 4, name: "body", kind: "scalar", T: ScalarType.BYTES, opt: true },
// { no: 12, name: "isreserved", kind: "scalar", T: ScalarType.INT32, opt: true }
// ]);
// export const OidbSvcTrpcTcp0XED3_1 = new MessageType("oidb_svc_trpctcp_0xed3_1", [
// { no: 1, name: "uin", kind: "scalar", T: ScalarType.UINT32 },
// { no: 2, name: "groupuin", kind: "scalar", T: ScalarType.UINT32, opt: true },
// { no: 5, name: "frienduin", kind: "scalar", T: ScalarType.UINT32, opt: true },
// { no: 6, name: "ext", kind: "scalar", T: ScalarType.UINT32 }
// ]);
// export function encodeGroupPoke(groupUin: number, PeerUin: number) {
// let Body = OidbSvcTrpcTcp0XED3_1.toBinary
// ({
// uin: PeerUin,
// groupuin: groupUin,
// ext: 0
// });
// //console.log(Body)
// return OidbSvcTrpcTcpBase.toBinary
// ({
// command: 0xed3,
// subcommand: 1,
// body: Body
// });
// }
+9
View File
@@ -0,0 +1,9 @@
import { ScalarType } from "@protobuf-ts/runtime";
import { ProtoField } from "../NapProto";
export const OidbSvcTrpcTcp0XED3_1 = {
uin: ProtoField(1, ScalarType.UINT32),
groupUin: ProtoField(2, ScalarType.UINT32, false, true),
friendUin: ProtoField(5, ScalarType.BYTES, false, true),
ext: ProtoField(6, ScalarType.UINT32)
}
+7
View File
@@ -0,0 +1,7 @@
import { ScalarType } from "@protobuf-ts/runtime";
import { ProtoField } from "../NapProto";
export const OidbSvcTrpcTcp0XEE1_2 = {
uin: ProtoField(1, ScalarType.UINT32),
key: ProtoField(3, ScalarType.BYTES, false, true),
}
+9
View File
@@ -0,0 +1,9 @@
import { ProtoField } from "../NapProto";
import { ScalarType } from '@protobuf-ts/runtime';
export const OidbSvcTrpcTcpBase = {
command: ProtoField(1, ScalarType.UINT32),
subCommand: ProtoField(2, ScalarType.UINT32),
body: ProtoField(4, ScalarType.BYTES),
isReserved: ProtoField(12, ScalarType.UINT32, false, true)
}
File renamed without changes.
File renamed without changes.