*Update protobuf
This commit is contained in:
parent
ebaba22213
commit
7b920bf2f5
|
@ -10,14 +10,13 @@
|
|||
"protomux-rpc": "^1.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@protobuf-ts/plugin": "^2.8.1",
|
||||
"@protobuf-ts/plugin": "^2.8.2",
|
||||
"@types/b4a": "^1.6.0",
|
||||
"@types/debug": "^4.1.7",
|
||||
"b4a": "^1.6.1",
|
||||
"debug": "^4.3.4",
|
||||
"hyperswarm": "^4.3.5",
|
||||
"prettier": "^2.7.1",
|
||||
"protoc": "^1.1.3",
|
||||
"sleep-promise": "^9.1.0",
|
||||
"sodium-universal": "^3.1.0",
|
||||
"tape": "^5.6.1"
|
||||
|
|
192
src/messages.ts
192
src/messages.ts
|
@ -1,4 +1,4 @@
|
|||
// @generated by protobuf-ts 2.8.1
|
||||
// @generated by protobuf-ts 2.8.2
|
||||
// @generated from protobuf file "messages.proto" (syntax proto2)
|
||||
// tslint:disable
|
||||
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
|
||||
|
@ -14,121 +14,87 @@ import { MessageType } from "@protobuf-ts/runtime";
|
|||
/**
|
||||
* @generated from protobuf message Packet
|
||||
*/
|
||||
export interface PacketType {
|
||||
/**
|
||||
* @generated from protobuf field: bytes originId = 1;
|
||||
*/
|
||||
originId: Uint8Array;
|
||||
/**
|
||||
* @generated from protobuf field: uint32 messageNumber = 2;
|
||||
*/
|
||||
messageNumber: number;
|
||||
/**
|
||||
* @generated from protobuf field: uint32 ttl = 3;
|
||||
*/
|
||||
ttl: number;
|
||||
/**
|
||||
* @generated from protobuf field: bytes data = 4;
|
||||
*/
|
||||
data: Uint8Array;
|
||||
export interface Packet {
|
||||
/**
|
||||
* @generated from protobuf field: bytes originId = 1;
|
||||
*/
|
||||
originId: Uint8Array;
|
||||
/**
|
||||
* @generated from protobuf field: uint32 messageNumber = 2;
|
||||
*/
|
||||
messageNumber: number;
|
||||
/**
|
||||
* @generated from protobuf field: uint32 ttl = 3;
|
||||
*/
|
||||
ttl: number;
|
||||
/**
|
||||
* @generated from protobuf field: bytes data = 4;
|
||||
*/
|
||||
data: Uint8Array;
|
||||
}
|
||||
// @generated message type with reflection information, may provide speed optimized methods
|
||||
class Packet$Type extends MessageType<PacketType> {
|
||||
constructor() {
|
||||
super("Packet", [
|
||||
{ no: 1, name: "originId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
||||
{
|
||||
no: 2,
|
||||
name: "messageNumber",
|
||||
kind: "scalar",
|
||||
T: 13 /*ScalarType.UINT32*/,
|
||||
},
|
||||
{ no: 3, name: "ttl", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
|
||||
{ no: 4, name: "data", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<PacketType>): PacketType {
|
||||
const message = {
|
||||
originId: new Uint8Array(0),
|
||||
messageNumber: 0,
|
||||
ttl: 0,
|
||||
data: new Uint8Array(0),
|
||||
};
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, {
|
||||
enumerable: false,
|
||||
value: this,
|
||||
});
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial<PacketType>(this, message, value);
|
||||
return message;
|
||||
}
|
||||
internalBinaryRead(
|
||||
reader: IBinaryReader,
|
||||
length: number,
|
||||
options: BinaryReadOptions,
|
||||
target?: PacketType
|
||||
): PacketType {
|
||||
let message = target ?? this.create(),
|
||||
end = reader.pos + length;
|
||||
while (reader.pos < end) {
|
||||
let [fieldNo, wireType] = reader.tag();
|
||||
switch (fieldNo) {
|
||||
case /* bytes originId */ 1:
|
||||
message.originId = reader.bytes();
|
||||
break;
|
||||
case /* uint32 messageNumber */ 2:
|
||||
message.messageNumber = reader.uint32();
|
||||
break;
|
||||
case /* uint32 ttl */ 3:
|
||||
message.ttl = reader.uint32();
|
||||
break;
|
||||
case /* bytes data */ 4:
|
||||
message.data = reader.bytes();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
if (u === "throw")
|
||||
throw new globalThis.Error(
|
||||
`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
|
||||
);
|
||||
let d = reader.skip(wireType);
|
||||
if (u !== false)
|
||||
(u === true ? UnknownFieldHandler.onRead : u)(
|
||||
this.typeName,
|
||||
message,
|
||||
fieldNo,
|
||||
wireType,
|
||||
d
|
||||
);
|
||||
}
|
||||
class Packet$Type extends MessageType<Packet> {
|
||||
constructor() {
|
||||
super("Packet", [
|
||||
{ no: 1, name: "originId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
||||
{ no: 2, name: "messageNumber", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
|
||||
{ no: 3, name: "ttl", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
|
||||
{ no: 4, name: "data", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<Packet>): Packet {
|
||||
const message = { originId: new Uint8Array(0), messageNumber: 0, ttl: 0, data: new Uint8Array(0) };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial<Packet>(this, message, value);
|
||||
return message;
|
||||
}
|
||||
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Packet): Packet {
|
||||
let message = target ?? this.create(), end = reader.pos + length;
|
||||
while (reader.pos < end) {
|
||||
let [fieldNo, wireType] = reader.tag();
|
||||
switch (fieldNo) {
|
||||
case /* bytes originId */ 1:
|
||||
message.originId = reader.bytes();
|
||||
break;
|
||||
case /* uint32 messageNumber */ 2:
|
||||
message.messageNumber = reader.uint32();
|
||||
break;
|
||||
case /* uint32 ttl */ 3:
|
||||
message.ttl = reader.uint32();
|
||||
break;
|
||||
case /* bytes data */ 4:
|
||||
message.data = reader.bytes();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
if (u === "throw")
|
||||
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||
let d = reader.skip(wireType);
|
||||
if (u !== false)
|
||||
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
internalBinaryWrite(message: Packet, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
||||
/* bytes originId = 1; */
|
||||
if (message.originId.length)
|
||||
writer.tag(1, WireType.LengthDelimited).bytes(message.originId);
|
||||
/* uint32 messageNumber = 2; */
|
||||
if (message.messageNumber !== 0)
|
||||
writer.tag(2, WireType.Varint).uint32(message.messageNumber);
|
||||
/* uint32 ttl = 3; */
|
||||
if (message.ttl !== 0)
|
||||
writer.tag(3, WireType.Varint).uint32(message.ttl);
|
||||
/* bytes data = 4; */
|
||||
if (message.data.length)
|
||||
writer.tag(4, WireType.LengthDelimited).bytes(message.data);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
return writer;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
internalBinaryWrite(
|
||||
message: PacketType,
|
||||
writer: IBinaryWriter,
|
||||
options: BinaryWriteOptions
|
||||
): IBinaryWriter {
|
||||
/* bytes originId = 1; */
|
||||
if (message.originId.length)
|
||||
writer.tag(1, WireType.LengthDelimited).bytes(message.originId);
|
||||
/* uint32 messageNumber = 2; */
|
||||
if (message.messageNumber !== 0)
|
||||
writer.tag(2, WireType.Varint).uint32(message.messageNumber);
|
||||
/* uint32 ttl = 3; */
|
||||
if (message.ttl !== 0) writer.tag(3, WireType.Varint).uint32(message.ttl);
|
||||
/* bytes data = 4; */
|
||||
if (message.data.length)
|
||||
writer.tag(4, WireType.LengthDelimited).bytes(message.data);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? UnknownFieldHandler.onWrite : u)(
|
||||
this.typeName,
|
||||
message,
|
||||
writer
|
||||
);
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message Packet
|
||||
|
|
Loading…
Reference in New Issue