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