Pamoja.Routing
0.1.17
dotnet add package Pamoja.Routing --version 0.1.17
NuGet\Install-Package Pamoja.Routing -Version 0.1.17
<PackageReference Include="Pamoja.Routing" Version="0.1.17" />
<PackageVersion Include="Pamoja.Routing" Version="0.1.17" />
<PackageReference Include="Pamoja.Routing" />
paket add Pamoja.Routing --version 0.1.17
#r "nuget: Pamoja.Routing, 0.1.17"
#:package Pamoja.Routing@0.1.17
#addin nuget:?package=Pamoja.Routing&version=0.1.17
#tool nuget:?package=Pamoja.Routing&version=0.1.17
Pamoja.Routing
Reverse-path routing that learns the cheapest route from overheard traffic. One capability of pamoja, one memory-safe Rust core with bindings for TypeScript, Python, and C#.
Install
dotnet add package Pamoja.Routing
using Pamoja.Routing;
This pulls in Pamoja.Native, the compiled engine. dotnet add package Pamoja is the whole framework in one package.
Example
The guide project's example, spliced here as it ran in CI.
From bindings/dotnet/samples/Pamoja.Guides/RoutingGuide.cs:
// The nodes on this mesh. An address is just a number; naming them is what makes
// the table below read as a map of the site rather than a list of numbers.
const byte Gateway = 1;
const byte Pump = 9;
const byte Tank = 10;
const byte NorthRelay = 5;
const byte EastRelay = 7;
const byte SouthRelay = 3;
const byte Silo = 32;
// A node learns the way to another from traffic it already hears: a packet from
// the pump that arrived through the north relay proves that relay is a way back,
// at the cost the packet reports.
using Router router = new(Gateway, 4);
router.Observe(Pump, NorthRelay, 2);
// The table keeps only the cheapest way it knows to each node, so a cost-1 report
// through the east relay takes over and the later cost-4 report changes nothing.
router.Observe(Pump, EastRelay, 1);
router.Observe(Pump, SouthRelay, 4);
router.Observe(Tank, NorthRelay, 3);
Route? route = router.RouteTo(Pump);
Console.WriteLine($"to the pump via {route?.NextHop} at cost {route?.Cost}");
Console.WriteLine($"routes held {router.Count}");
// Every packet gets one of three answers: deliver it here, relay it to the
// neighbour on the way, or flood it because no route is known yet.
foreach ((string name, byte address) in
new[] { ("gateway", Gateway), ("pump", Pump), ("silo", Silo) })
{
ForwardDecision decision = router.Forward(address);
Console.WriteLine(decision.Action switch
{
ForwardAction.Deliver => $"for the {name,-8} deliver here",
ForwardAction.Relay => $"for the {name,-8} relay via {decision.NextHop}",
_ => $"for the {name,-8} flood, no route known",
});
}
// Forgetting a node that has gone quiet returns its traffic to flooding, so
// routing is an optimisation over flooding rather than a second thing that can
// fail.
router.Forget(Pump);
ForwardDecision after = router.Forward(Pump);
Console.WriteLine(
$"pump forgotten, so it floods again: {after.Action == ForwardAction.Flood}");
The same capability in every language
| Language | Package | Reference |
|---|---|---|
| Rust | pamoja-routing |
reference, docs.rs, install |
| TypeScript | @pamoja/routing |
reference, install |
| Python | pamoja-routing |
reference, install |
| C# | Pamoja.Routing |
reference, install |
Documentation
Pamoja.Routingreference, every type in this namespace.- The Routing guide, with the same example in Rust, TypeScript, and Python.
- Every capability, and the install page.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Pamoja.Native (>= 0.1.17)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Pamoja.Routing:
| Package | Downloads |
|---|---|
|
Pamoja
The whole pamoja framework in one package: every capability of one memory-safe Rust core, behind an idiomatic C# facade, for IoT, robotics, and drones. |
|
|
Pamoja.Radio
Radio and reach: Budgeting airtime, framing a mesh packet, routing it, and securing a LoRaWAN uplink: everything a node needs to reach a network it cannot see. |
GitHub repositories
This package is not used by any popular GitHub repositories.