Browse Source

Add simulator

pull/2/head
Magic_RB 1 year ago
parent
commit
274483d0a8
  1. 12
      simulator/Cargo.toml
  2. 38
      simulator/src/main.rs

12
simulator/Cargo.toml

@ -0,0 +1,12 @@
[package]
name = "algorithmic-tests"
version = "0.1.0"
authors = ["Magic_RB <magic_rb@redalder.org>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
base64 = "0.12.*"
sha3 = "0.9.*"
crypto = { path = "../crypto" }

38
simulator/src/main.rs

@ -0,0 +1,38 @@
use std::rc::Rc;
struct Peer {
address: String,
address_range: (u64, u64),
}
enum Node {
Peer(Peer),
Subnet {
address: String,
address_range: (u64, u64),
network: Network
}
}
struct Network {
nodes: Vec<Rc<Node>>,
}
impl Network {
pub fn new<T: AsRef<str>>(base_peer: T) -> Self {
let base_peer = base_peer.as_ref();
let parts: Vec<&str> = base_peer.split('.').collect();
}
pub fn add_peer<T: AsRef<str>>(&mut self, address: T) {
}
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut network = Network::new();
network.add_peer("org.redalder.heater");
Ok(())
}
Loading…
Cancel
Save