collect channel and gateway data for traceroutes

This commit is contained in:
liamcottle
2024-03-19 02:27:23 +13:00
parent fc2f01d31b
commit 961ea71c84
3 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,5 @@
-- AlterTable
ALTER TABLE `traceroutes` ADD COLUMN `channel` INTEGER NULL,
ADD COLUMN `channel_id` VARCHAR(191) NULL,
ADD COLUMN `gateway_id` BIGINT NULL,
ADD COLUMN `packet_id` BIGINT NULL;

View File

@ -151,6 +151,11 @@ model TraceRoute {
node_id BigInt
route Json
channel Int?
packet_id BigInt?
channel_id String?
gateway_id BigInt?
created_at DateTime @default(now())
updated_at DateTime @default(now()) @updatedAt

View File

@ -380,6 +380,10 @@ client.on("message", async (topic, message) => {
data: {
node_id: envelope.packet.from,
route: routeDiscovery.route,
channel: envelope.packet.channel,
packet_id: envelope.packet.id,
channel_id: envelope.channelId,
gateway_id: envelope.gatewayId ? BigInt('0x' + envelope.gatewayId.replaceAll("!", "")) : null, // convert hex id "!f96a92f0" to bigint
},
});
} catch (e) {