Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spec/message-relaying #7

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,15 @@
> Ultralight Beam describes a protocol for sending offline messages that will later be broadcasted through relay nodes.

This repository contains the specs for [Ultralight Beam](https://ultralightbeam.io), a transport agnostic MANET (Mobile Ad-Hoc Network) for sending arbitrary data.

## Status

Ultralight Beam is under active development, each specification has its own `status` which is reflected through the version number at the top of every document. We use [semver](https://semver.org/) to version these specifications.

## Core

These specs document core functionality of the Ultralight Beam protocol.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammar


- [Message Relaying](./message-relaying.md) - The process for sending and relaying messages within Ultralight Beam.

All specs follow [RFC-2119](https://tools.ietf.org/html/rfc2119).
44 changes: 44 additions & 0 deletions message-relaying.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Message Relaying

> Version: 0.1.0 (Draft)
>
> Authors: Dean Eigenmann <[email protected]>

## Table of Contents

1. [Abstract](#abstract)
2. [Definitions](#definitions)
3. [Relaying](#relaying)
4. [Footnotes](#footnotes)

## Abstract

In this specification, we describe how nodes relay messages. This includes nodes sending initial messages as well as nodes relaying messages they have received from other nodes.

## Definitions

| Term | Definition |
| ----------- | --------------------------------------- |
| Origin | The initial sender of any message. |
| Last sender | The last node a message hopped through. |


## Relaying

There are three modes with which a packet can be sent to peers, they both depend on the message along with the nodes state.

A message MUST either contain a `recipient` address or a target `protocol`.

<!-- @TODO REFERENCE MESSAGE SPEC THAT WILL DEFINE RECIPIENT AND PROTOCOL -->

If a message contains a `recipient`, a node MUST initially try and send it to the recipient's address. If a node does not have a direct connection it MAY send it to any number of its peers.

If a message contains a `protocol`, a node MUST initially try and send it to any peer that supports it. If non of the nodes peers support this protocol, we MAY send it to any number of its peers.

When sending a message to any peer, a node MUST ensure they are neither the `origin` nor `last sender`. A node SHOULD abstain from flooding a message given it has a more effective manner to route it towards its target.

## Footnotes
1. <https://github.com/ultralight-beam/UB.swift/pull/42> - A pull request in the swift implementation that implements this sending logic.

<!-- @TODO THINK ABOUT TRANSMITTING SOME FORM OF ROUTE LIST SO WE NEVER SEND IT TO ANY PRIOR RECIPIENT -->