Commit e330ec97 authored by Katharina Fey's avatar Katharina Fey

Initial commit

parents
/target
**/*.rs.bk
This diff is collapsed.
[package]
name = "example-app"
version = "0.1.0"
authors = ["YOU <you@example.com>"]
edition = "2018"
# This app depends on libqaul and the underlying routing layer
[dependencies]
libqaul = { git = "https://git.open-communication.net/qaul/qaul.net" }
ratman = { git = "https://git.open-communication.net/qaul/qaul.net" }
netmod-mem = { git = "https://git.open-communication.net/qaul/qaul.net" }
\ No newline at end of file
# qaul.net example service
This is a small example project using libqaul, created for the 36C3
open infrastructure orbit workshop (day 1). It is meant to let you
play with the current state of qaul.net development without having to
faff around with network setup. Instead, it uses in-memory channels
inside the same application to send messages. UDP overlay drivers
exist are currently very experimental.
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "qaul-example-app";
buildInputs = with pkgs; [
rustracer rustup clangStdenv cargo-watch
];
}
#![allow(unused)]
use libqaul::Qaul;
use ratman::Router;
use netmod_mem::MemMod;
use std::sync::Arc;
struct TestNetwork {
q1: Arc<Qaul>,
q2: Arc<Qaul>,
q3: Arc<Qaul>,
}
/// This function creates a little test network with three nodes.
///
/// Users and services can be created on all three nodes to simulate a
/// larger network. Because the links are only p2p, to get from A to
/// C, a message must traverse node B.
///
/// ```
/// A - B - C
/// ```
fn init_network() -> TestNetwork {
let mut mm1 = MemMod::new();
let mut mm2 = MemMod::new();
let mut mm3 = MemMod::new();
let mut mm4 = MemMod::new();
mm1.link(&mut mm2);
mm3.link(&mut mm4);
let r1 = Router::new();
let r2 = Router::new();
let r3 = Router::new();
r1.modify().add_ep(mm1);
r2.modify().add_ep(mm2);
r2.modify().add_ep(mm3);
r3.modify().add_ep(mm4);
TestNetwork {
q1: Qaul::new(r1),
q2: Qaul::new(r2),
q3: Qaul::new(r3),
}
}
fn main() {
let _network = init_network();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment