5a07b73375
* removed mnemonic from gateway config struct scaffolding for common mixnet listener running verloc unconditionally in a nym-node remove filtering by mixnode extracted verloc to separate crate integrated nym-node-http-server more tightly with the binary most logic for handling forward packets running all mixnode-related tasks natively inside nymnode removed gateway storage trait in favour of the only concrete implementation most logic for handling final hop packets using nym-node owned socket listener for gateways utility for sending plain message through mixnet + gateway fix using common packet forwarding in both modes nifying nym-node metrics reproduce behaviour of the console logger cleaned up cli args redesigned gateway tasks startup procedure removing dead code scaffolding for old config v6 config migration implemented MixnetMetricsCleaner * clippy * require entry/exit for wireguard * removed dead code in migration code * updated config template * use custom user agent for verloc queries * fixed premature shutdown of gateway tasks * hidden nym-api flag to allow illegal node ips * experiment: final hop handing with wireguard * added additional startup logs * typo * fixed legacy stats endpoint data * additional logs * apply review comments * fixed local testnet manager
43 lines
1.2 KiB
Rust
43 lines
1.2 KiB
Rust
// Copyright 2024 - Nym Technologies SA <contact@nymtech.net>
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
//! Nym Statistics
|
|
//!
|
|
//! This crate contains basic statistics utilities and abstractions to be re-used and
|
|
//! applied throughout both the client and gateway implementations.
|
|
|
|
#![warn(clippy::expect_used)]
|
|
#![warn(clippy::unwrap_used)]
|
|
#![warn(clippy::todo)]
|
|
#![warn(clippy::dbg_macro)]
|
|
|
|
use nym_crypto::asymmetric::ed25519;
|
|
use sha2::{Digest, Sha256};
|
|
|
|
/// Client specific statistics interfaces and events.
|
|
pub mod clients;
|
|
/// Statistics related errors.
|
|
pub mod error;
|
|
/// Gateway specific statistics interfaces and events.
|
|
pub mod gateways;
|
|
/// Statistics reporting abstractions and implementations.
|
|
pub mod report;
|
|
|
|
const CLIENT_ID_PREFIX: &str = "client_stats_id";
|
|
|
|
pub fn generate_client_stats_id(id_key: ed25519::PublicKey) -> String {
|
|
generate_stats_id(CLIENT_ID_PREFIX, id_key.to_base58_string())
|
|
}
|
|
|
|
fn generate_stats_id<M: AsRef<[u8]>>(prefix: &str, id_seed: M) -> String {
|
|
let mut hasher = sha2::Sha256::new();
|
|
hasher.update(prefix);
|
|
hasher.update(&id_seed);
|
|
let output = hasher.finalize();
|
|
format!("{:x}", output)
|
|
}
|
|
|
|
pub fn hash_identifier<M: AsRef<[u8]>>(identifier: M) -> String {
|
|
format!("{:x}", Sha256::digest(identifier))
|
|
}
|