From 18dd29b6efc4d8ed5828954c461d93a60f009876 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Wed, 4 Jul 2018 12:41:43 +0100 Subject: [PATCH] wip on wire protocol --- doc/wire-protocol.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/doc/wire-protocol.md b/doc/wire-protocol.md index e95e0732..98f80718 100644 --- a/doc/wire-protocol.md +++ b/doc/wire-protocol.md @@ -67,6 +67,7 @@ Sent by a leaf when performing a search. Contains the reply-to b64 destination { type : "Search", version: 1, + uuid: "asdf-1234..." firstHop: false, keywords : "great speeches" replyTo : "asdfasf..." @@ -90,3 +91,33 @@ This message starts with a single byte which indicates the size of the bloom fil #### Patch This message starts with two unsigned bytes indicating the number of patches included in the message. Each patch consists of 3 bytes, where the most significant bit indicates whether the corresponding bit should be set or cleared and the remaining 23 contain the position within the Bloom filter that is to be patched. + +### Any node to any node over datagrams + +Search results are sent in "Result" type message over an I2P datagram, uncompressed. The format of this message is the following: + +``` +{ + type: "Result", + version: 1, + uuid: "asdf-1234-...", + address : "asdfqwer...b64" + results : [ + { + name: "File name 1", + infohash: "asdfasdf...", + altlocs: [ "b64.1", "b64.2", ...] + }, + { + name: "File name 2", + infohash: "asdfasdf...", + altlocs: [ "b64.3", "b64.4", ... ] + }, + ... + ] +} +``` + +* The "uuid" field must match the uuid of the "Search" message which triggered this search result. +* The "address" field is the I2P Destination listening to incoming HTTP requests that can serve the file +* The "altlocs" list contains list of alternate locations in b64 format that may also have the file. \ No newline at end of file