mirror of
https://github.com/meshcore-dev/meshcore.js.git
synced 2026-04-20 22:13:49 +00:00
show routing path to contact
This commit is contained in:
parent
46b18d00ae
commit
6ffd7ef270
3 changed files with 13 additions and 2 deletions
|
|
@ -106,6 +106,11 @@
|
|||
<div class="font-semibold">{{ contact.advName }}</div>
|
||||
<div class="text-sm text-gray-500"><{{ bytesToHex(contact.publicKey) }}></div>
|
||||
<div class="text-sm text-gray-500">Type: {{ contactTypeToString(contact.type) }} • Last Advert: {{ contact.lastAdvert }}</div>
|
||||
<div class="text-sm text-gray-500">
|
||||
<span v-if="contact.outPathLen === -1">Path: ???</span>
|
||||
<span v-else-if="contact.outPathLen === 0">Path: Direct</span>
|
||||
<span v-else>Path: {{ contact.outPathLen }} hops</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex my-auto ml-2 space-x-2">
|
||||
<div @click="sendMessage(contact)" class="hover:underline cursor-pointer">Message</div>
|
||||
|
|
|
|||
|
|
@ -36,6 +36,12 @@ class BufferReader {
|
|||
}
|
||||
}
|
||||
|
||||
readInt8() {
|
||||
const bytes = this.readBytes(1);
|
||||
const view = new DataView(bytes.buffer);
|
||||
return view.getInt8(0);
|
||||
}
|
||||
|
||||
readUInt16LE() {
|
||||
const bytes = this.readBytes(2);
|
||||
const view = new DataView(bytes.buffer);
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ class Connection extends EventEmitter {
|
|||
data.writeBytes(publicKey);
|
||||
data.writeByte(type);
|
||||
data.writeByte(flags);
|
||||
data.writeByte(outPathLen);
|
||||
data.writeByte(outPathLen); // todo writeInt8
|
||||
data.writeBytes(outPath); // 64 bytes
|
||||
data.writeCString(advName, 32); // 32 bytes
|
||||
data.writeUInt32LE(lastAdvert);
|
||||
|
|
@ -211,7 +211,7 @@ class Connection extends EventEmitter {
|
|||
publicKey: bufferReader.readBytes(32),
|
||||
type: bufferReader.readByte(),
|
||||
flags: bufferReader.readByte(),
|
||||
outPathLen: bufferReader.readByte(),
|
||||
outPathLen: bufferReader.readInt8(),
|
||||
outPath: bufferReader.readBytes(64),
|
||||
advName: bufferReader.readCString(32),
|
||||
lastAdvert: bufferReader.readUInt32LE(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue