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
60 lines
2.0 KiB
Rust
60 lines
2.0 KiB
Rust
// Copyright 2024 - Nym Technologies SA <contact@nymtech.net>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
use crate::config::Config;
|
|
use crate::error::NymNodeError;
|
|
use crate::node::helpers::load_ed25519_identity_public_key;
|
|
use nym_crypto::asymmetric::ed25519;
|
|
use serde::{Deserialize, Serialize};
|
|
use std::fmt::{Display, Formatter};
|
|
|
|
#[derive(Debug, Deserialize, Serialize)]
|
|
pub struct BondingInformation {
|
|
host: String,
|
|
identity_key: ed25519::PublicKey,
|
|
}
|
|
|
|
impl Display for BondingInformation {
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
writeln!(f, "Identity Key: {}", self.identity_key)?;
|
|
writeln!(f, "Host: {}", self.host)?;
|
|
writeln!(f, "Custom HTTP Port: you might want to set it if your node won't be accessible on any of the ports: 80/443/8080")?;
|
|
|
|
Ok(())
|
|
}
|
|
}
|
|
|
|
impl BondingInformation {
|
|
pub fn from_data(config: &Config, ed25519_identity_key: ed25519::PublicKey) -> Self {
|
|
let host = match config.host.hostname {
|
|
Some(ref host) => host.clone(),
|
|
None => match config.host.public_ips.first() {
|
|
Some(first_ip) => {
|
|
if !first_ip.is_loopback()
|
|
&& !first_ip.is_multicast()
|
|
&& !first_ip.is_unspecified()
|
|
{
|
|
first_ip.to_string()
|
|
} else {
|
|
"NO KNOWN VALID HOSTNAMES - YOU NEED TO FILL IT MANUALLY".to_string()
|
|
}
|
|
}
|
|
None => "NO KNOWN VALID HOSTNAMES - YOU NEED TO FILL IT MANUALLY".to_string(),
|
|
},
|
|
};
|
|
|
|
BondingInformation {
|
|
host,
|
|
identity_key: ed25519_identity_key,
|
|
}
|
|
}
|
|
|
|
pub fn try_load(config: &Config) -> Result<BondingInformation, NymNodeError> {
|
|
let ed25519_identity_key = load_ed25519_identity_public_key(
|
|
&config.storage_paths.keys.public_ed25519_identity_key_file,
|
|
)?;
|
|
|
|
Ok(Self::from_data(config, ed25519_identity_key))
|
|
}
|
|
}
|