Feature/add rocket (#600)
* Added rocket at a git tag * Adding Rocket to the mixnode * Verloc route now in place * Adding an http api startup notification * Updated version number to 0.10.1-dev * Fixing clippy warnings * Compressing split a bit * Adjusted used version of js-sys Co-authored-by: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
This commit is contained in:
@@ -0,0 +1 @@
|
||||
pub(crate) mod verloc;
|
||||
@@ -0,0 +1,28 @@
|
||||
use rocket_contrib::json::Json;
|
||||
use serde::Serialize;
|
||||
|
||||
/// Provides verifiable location (verloc) measurements for this mixnode - a list of the
|
||||
/// round-trip times, in milliseconds, for all other mixnodes that this node knows about.
|
||||
#[get("/verloc")]
|
||||
pub(crate) fn verloc() -> Json<Vec<Foomp>> {
|
||||
// replace the foomps with a reference to the measurements vec :)
|
||||
let foomp1 = Foomp {
|
||||
ip: "1.2.3.4".to_string(),
|
||||
port: "1789".to_string(),
|
||||
identity_key: "abc".to_string(),
|
||||
};
|
||||
let foomp2 = Foomp {
|
||||
ip: "2.3.4.5".to_string(),
|
||||
port: "1789".to_string(),
|
||||
identity_key: "def".to_string(),
|
||||
};
|
||||
let foomps = vec![foomp1, foomp2];
|
||||
Json(foomps)
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub(crate) struct Foomp {
|
||||
ip: String,
|
||||
port: String,
|
||||
identity_key: String,
|
||||
}
|
||||
Reference in New Issue
Block a user