Table of contents
- Differences between this repo & docs.ockam.io/Reference/Programming Libraries/Rust
- Following Rust API guides below
- Run the examples
Differences between this repo & docs.ockam.io/Reference/Programming Libraries/Rust
This repo is just an experiment to see if I can improve on the examples using colored output, more helpful stdout messages, and more concise code.
- All the code examples have colorized output so that it is clear to see which node is outputting
what to
stdout
. Lots of helpful text has been added to inform the developer about what the program is doing. - Instead of having multiple source files for certain examples (eg:
secure channels),
all the examples are self contained in a single source file using
tokio::spawn
to run multiple nodes concurrently, and shut down the entire example cleanly. - The exception to using
tokio:spawn
is the credential exchange example which has 3 source files (didn't work w/tokio:spawn
for some reason). Here's the command to run this:gnome-terminal -x sh -c "cargo run --example 06-credential-exchange-issuer" gnome-terminal -x sh -c "cargo run --example 06-credential-exchange-server" cargo run --example 06-credential-exchange-client
- All short variable names are replaced w/ longer more readable ones.
- Rust API
- Nodes and Workers
- Routing and transports
- Identities and Vaults
- Secure Channels
- Credentials and Authorities
OCKAM_LOG=none cargo run --example 01-node
OCKAM_LOG=none cargo run --example 02-worker
OCKAM_LOG=none cargo run --example 03-routing
OCKAM_LOG=none cargo run --example 03-routing-many-hops
OCKAM_LOG=none cargo run --example 04-routing-over-transport
OCKAM_LOG=none cargo run --example 04-routing-over-two-transport-hops
OCKAM_LOG=none cargo run --example 05-identity
OCKAM_LOG=none cargo run --example 05-secure-channel-over-two-transport-hops-responder
gnome-terminal -x sh -c "OCKAM_LOG=none cargo run --example 06-credential-exchange-issuer"
gnome-terminal -x sh -c "OCKAM_LOG=none cargo run --example 06-credential-exchange-server"
OCKAM_LOG=none cargo run --example 06-credential-exchange-client
Diagrams in http://asciiflow.com
- 01-node.rs: https://asciiflow.com/#/share/eJyrVspLzE1VssorzcnRUcpJrEwtUrJSqo5RqohRsrK0NNSJUaoEsozMLYGsktSKEiAnRunRlD1UQTExeUBSQcEvPyVVwVABBcClqWoTNoAkTZ7h6EYoOKakFKUWF1shLMBQop5YUKCO4gZMhzSQiFCNwOtV6gSqUq1SLQAC/z9O
- 02-worker.rs: https://asciiflow.com/#/share/eJyrVspLzE1VssorzcnRUcpJrEwtUrJSqo5RqohRsrK0NNSJUaoEsozMLYGsktSKEiAnRunRlJ5HUxooRhNiYvIeTWlSUPDLT0lVMFRAAUAJsPQcati0BGYTNgCzqQnEJMNjE9CMaFJwTEkpSi0utkJYgKFEPbGgQB3FDWhKpoDNXkOUE6ZtAjNmoBgBNRTNDmzenbaHOI9uocC7qckZ+alF6gS8SxJC9y7umCXDcCzWxSjVKtUCAO/Vn64=)
- 03-routing.rs: https://asciiflow.com/#/share/eJyrVspLzE1VslIyMFbSUcpJrEwtAnKqY5QqYpSsLC0NdWKUKoEsIwsDIKsktaIEyIlRejRlD1VQTEwekFRQ8MtPSVUwVEABj6Y0QaSpahM2gCT9aErPoykNJKIJaEY0KTimpBSlFhdbIbyCoUQ9saBAHcW3aEqmgM3eQ5QTpu0CM2agGAHmoPkTu3enEWfLlC0UeDcjv6AgtchQnSre3UQX7+6hwLupyRn5qUXqOJVMIT2ZoXsXb0LGK02dHKVUq1QLACw0OTI
- 03-routing-many-hops.rs: https://asciiflow.com/#/share/eJyrVspLzE1VslIyMNY1UtJRykmsTC0CcqtjlCpilKwsLQ11YpQqgSwjCwMgqyS1ogTIiVF6NGUPtVBMTB6QVFDwy09JVTBUQAVweWrbhhUgyT%2Ba0vNoSgOJaAK6GU0KjikpRanFxVZwG5ow1agnFhSoI7sCQ80UsPF7iHLFtF1gxgxUM8AcNL%2Fi8PM04uyZsoUiP2fkFxSkFhnq6RmrQ9RUGFPg50108vMeivycmpyRn1qkjlvNFNLTHIaf8adr%2FPJUy2VKtUq1AL84Qzs%3D)
- 04-routing-over-transport.rs: https://asciiflow.com/#/share/eJytVD1ugzAUvor1FpYMqI0UwVb1Ah06WqoQWC1SaiPjIVEUqUIZO2SwaIaOPUHVqeI0nKQG4iYmTksAywhb7%2Bd73%2FserIAGzwR8cKcwgXmwJFxdVhgWGHzPu55gWKrT1cxTJ0EWQl0wlPK1lC%2BD9xZjWsqMsog8xDQWcSAYR%2FulDLX5fQykjwYJWZdGytAAXlsjTXYTRZykqW%2Bg1M8QEEvzqpxOkCROm5IGa9qrikkYjchJeys%2FWScs6t0BOv%2FU550GGVskVUqbjn5dJGPejZH8MmTU%2FSt6b3MY7m%2FvkOABVRJwsa%2FVFpd%2FWz3NZCGjlIQCCYamrutWLm8ba755nApCY%2FqIGG1828lkX6l2A9pUjc9pm85JeiR%2BaySKY9F7MzFZHRhdND6%2FbpqRnc7hyyxs%2F4fOwQ4JnxjhTq%2FgoTP9N8A5wz%2BB48iHYQ3rHwrvgOs%3D)