diff --git a/index.html b/index.html index b688ab6..86c345b 100644 --- a/index.html +++ b/index.html @@ -106,6 +106,11 @@
{{ contact.advName }}
<{{ bytesToHex(contact.publicKey) }}>
Type: {{ contactTypeToString(contact.type) }} • Last Advert: {{ contact.lastAdvert }}
+
+ Path: ??? + Path: Direct + Path: {{ contact.outPathLen }} hops +
Message
diff --git a/src/buffer_reader.js b/src/buffer_reader.js index 8ed5dd3..871d154 100644 --- a/src/buffer_reader.js +++ b/src/buffer_reader.js @@ -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); diff --git a/src/connection/connection.js b/src/connection/connection.js index 344864c..16a1b3c 100644 --- a/src/connection/connection.js +++ b/src/connection/connection.js @@ -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(),