From f98e5719621dc2f04f9eb6d425d873eb7e1eff28 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Thu, 15 Jul 2021 20:29:06 +0300 Subject: [PATCH] Multicasting usecase --- doc/usecases.ru.texi | 85 ++++++++++++++++++++++++++++++++++++++++++++ doc/usecases.texi | 83 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 168 insertions(+) diff --git a/doc/usecases.ru.texi b/doc/usecases.ru.texi index 39e1c6f..4b2f17a 100644 --- a/doc/usecases.ru.texi +++ b/doc/usecases.ru.texi @@ -14,6 +14,7 @@ * Обход сетевой цензуры, здоровье: UsecaseCensorRU * Разведка, шпионаж, тайная агентура: UsecaseSpyRU * Дешёвая ночная связь: UsecaseCallerRU +* Мультивещательная flooding рассылка: UsecaseMulticastRU @end menu @node UsecaseMailRU @@ -414,3 +415,87 @@ neigh: { } } @end verbatim + +@node UsecaseMulticastRU +@subsection Мультивещательная flooding рассылка + +Необходимо разослать одно и то же почтовое сообщение или файл многим +участникам? Например обновления какой либо программы, списка участников +сети или доступных файлов? Но при этом вы не соединены лично с каждым из +них: + +@verbatim + A-------->E---->F A <-> B C E + / \ |\ ^ C <-> H J + / \ | \ | E <-> D F G +v v v \v D <-> G +B C D---->G J <-> K + / \ ^ / K <-> D G + / \ | / + v v v / + H J<->K<- +@end verbatim + +В NNCP есть особые @ref{Multicast, мультивещательные} форматы пакетов +позволяющие организовывать эффективную передачу одно единственного +пакета сразу нескольким получателям (flooding алгоритм). @strong{A} +отправляет пакет трём получателям. @strong{C} в свою очередь отсылает +ещё двум, а @strong{E} трём. Некоторые участники сети получат несколько +копий одного и того же пакета, как например @strong{D}, @strong{J}, +@strong{G}, @strong{F}, но копии будут просто проигнорированы. Если +@strong{B} отошлёт пакет единственному ему известному @strong{A}, то +этот пакет распространится по всей сети подписантов широковещательной +зоны и дальше. + +Более того, мультивещательные пакеты зашифрованы и для прочтения требуют +знание ключей. Но это не мешает их обрабатывать для дальнейшей пересылки! +Кроме того, совершенно не обязательно знать ключи отправителя. Таким +образом можно создать эхоконференцию для передачи файлов или команд +(например доставки почтовых сообщений). + +Создаём ключи для мультивещательной зоны: + +@example +$ nncp-cfgnew -area filelists -nocomments +areas: @{ + filelists: @{ + id: TOU5TKOW4JBIZJBX63D4776C72FMWDAUAUSZNJX4DFOITVYQ5ZQA + pub: DSHL5O6BK2R3QKJAIJ7BC4UIGE73EC2LJPOV3VTS44KYOTUQYZLA + prv: AYD5FAA4GDDSAD5N65NJLLFS6TG2NSPQ46KAQO5U722JLVG34SOQ + @} +@} +@end example + +и отправляем ключевую пару всем кто может и хочет читать данную зону. +Посредникам, готовым участвовать в переотправке пакетов подписантам, но +которым не стоит "читать" пакеты, достаточно отправить только +идентификатор зоны. Например @strong{A} добавляет себе в конфигурацию: + +@example +areas: @{ + filelists: @{ + id: TOU... + pub: DSH... + prv: AYD... + subs: ["B", "C", "E"] + incoming: /home/A/areas/filelists + @} +@end example + +а @strong{E}, являющимся (как было решено) просто посредником: + +@example +areas: @{ + filelists: @{ + id: TOU... + subs: ["D", "F", "G"] + @} +@end example + +После распространения знания о @code{filelists} мультивещательной зоне +можно обмениваться @ref{FreqIndex, списками файлов}: + +@example +$ nncp-file tree-of-A-20210715.txt.zst area:filelists: +$ nncp-toss -node self +@end example diff --git a/doc/usecases.texi b/doc/usecases.texi index 1bf15e8..f5b30e3 100644 --- a/doc/usecases.texi +++ b/doc/usecases.texi @@ -16,6 +16,7 @@ See also this page @ref{Сценарии, on russian}. * Network censorship bypassing, health: UsecaseCensor * Reconnaissance, spying, intelligence, covert agents: UsecaseSpy * Cheap night transfers: UsecaseCaller +* Multicast flooding transmission: UsecaseMulticast @end menu @node UsecaseMail @@ -392,3 +393,85 @@ neigh: { } } @end verbatim + +@node UsecaseMulticast +@section Multicast flooding transmission + +Do you need to send single mail message or file to many recipients at +once? For example an update of some program, network participants list +or available files for freqing? But you are not connected directly to +each of them? + +@verbatim + A-------->E---->F A -> B C E + / \ |\ ^ C -> H J + / \ | \ | E -> D F G +v v v \v D -> G +B C D---->G J -> K + / \ ^ / K -> D G + / \ | / + v v v / + H J<->K<- +@end verbatim + +NNCP has @ref{Multicast, multicast} packets format, allowing you to +flood transmission of the single packet to multiple recipients. +@strong{A} sends packet to three destinations. @strong{C} sends it to +the two nodes next. @strong{E} sends it to three. Some participants may +receive multiple copies of the same packet, like @strong{D}, @strong{J}, +@strong{G}, @strong{F}, but that copies will be just ignored. If +@strong{B} sends packet to single known to him @strong{A}, then that +packet will be distributed among all other multicast area subscribers. + +Moreover those multicast packets are encrypted and require key knowledge +for reading. But that does not prevent their relaying! Also you are not +required to know sender's public keys. That way you can easily create +echo-conferences for files or commands (like mail message delivering) +transmission. + +Let's create keys for the new multicast area: + +@example +$ nncp-cfgnew -area filelists -nocomments +areas: @{ + filelists: @{ + id: TOU5TKOW4JBIZJBX63D4776C72FMWDAUAUSZNJX4DFOITVYQ5ZQA + pub: DSHL5O6BK2R3QKJAIJ7BC4UIGE73EC2LJPOV3VTS44KYOTUQYZLA + prv: AYD5FAA4GDDSAD5N65NJLLFS6TG2NSPQ46KAQO5U722JLVG34SOQ + @} +@} +@end example + +and send that keypair everybody who wants to read that area. +For intermediaries willing to relay packets on, but that should not read +them, you just need to send area's identity. For example @strong{A} adds +to his configuration: + +@example +areas: @{ + filelists: @{ + id: TOU... + pub: DSH... + prv: AYD... + subs: ["B", "C", "E"] + incoming: /home/A/areas/filelists + @} +@end example + +and @strong{E}, that will be relaying intermediary (as we decided): + +@example +areas: @{ + filelists: @{ + id: TOU... + subs: ["D", "F", "G"] + @} +@end example + +After you distributed the knowledge about @code{nodelist} multicast +area, you can share @ref{FreqIndex, file lists}: + +@example +$ nncp-file tree-of-A-20210715.txt.zst area:filelists: +$ nncp-toss -node self +@end example -- 2.44.0