f328f3fa9e
* Squashing all the changes initial router started expanding the API initial empty openapi/swagger populated build-info endpoint wip: populating rest of swagger missing swagger data + using closure capture for immutable state running the api as a proper task in gateway 'run' fixing some version/feature clashes refactored routes structures initial host information endpoint expanded on gateway-related endpoints signing host information moved all models to separate crate unified http api client routes unification + node api client new generic cache and refresher nym-api caching node self described information removed old cache type temporarily wired up NymContractCache to NodeDescriptionProvider caching self reported host info clients using self-described gateway information fixed request timeouts for wasm fixed wasm builds post rebase fixes cargo fmt brought in wg routes into nym-node router added ErrorResponse for wireguard routes basic swagger support for wg endpoints turns out swagger can be happy with strongly typed requests output type support for wg routes using concrete error type for nym node request error fixed the registration test landing page configurability increased configurability fixed build and lints of other crates added default user-agent to http-api-client reduced severity of gateway details lookup failure changed default http port from 80 to 8080 nym-api using new default port for queries added health endpoint nym-api trying multiple ports for the client using camelcase for node status corrected health endpoint description restored and revamped 'force_tls' flag to filter all gateways that support the wss protocol fixed 'pub_key' path param in open api schema derived Debug on 'NymNodeDescription' ensuring valid public ips added init and run flags to set hostname and public ips fixed listening address being pushed to public ip fixed the positional local flag logging remote ip address of the request updated helper function to query for described gateways enabled tls in gateway client removed hack-opts from mix fetch additional changes after rebasing against origin/develop * clippy * wasm-related target locking * more clippy, but this time in tests
147 lines
4.9 KiB
Rust
147 lines
4.9 KiB
Rust
// Copyright 2022-2023 - Nym Technologies SA <contact@nymtech.net>
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
use crate::client::mix_traffic::transceiver::ErasedGatewayError;
|
|
use nym_crypto::asymmetric::identity::Ed25519RecoveryError;
|
|
use nym_gateway_client::error::GatewayClientError;
|
|
use nym_topology::gateway::GatewayConversionError;
|
|
use nym_topology::NymTopologyError;
|
|
use nym_validator_client::ValidatorClientError;
|
|
use std::error::Error;
|
|
|
|
#[derive(thiserror::Error, Debug)]
|
|
pub enum ClientCoreError {
|
|
#[error("I/O error: {0}")]
|
|
IoError(#[from] std::io::Error),
|
|
|
|
#[error("Gateway client error ({gateway_id}): {source}")]
|
|
GatewayClientError {
|
|
gateway_id: String,
|
|
source: GatewayClientError,
|
|
},
|
|
|
|
#[error("Custom gateway client error: {source}")]
|
|
ErasedGatewayClientError {
|
|
#[from]
|
|
source: ErasedGatewayError,
|
|
},
|
|
|
|
#[error("Ed25519 error: {0}")]
|
|
Ed25519RecoveryError(#[from] Ed25519RecoveryError),
|
|
|
|
#[error("Validator client error: {0}")]
|
|
ValidatorClientError(#[from] ValidatorClientError),
|
|
|
|
#[error("No gateway with id: {0}")]
|
|
NoGatewayWithId(String),
|
|
|
|
#[error("No gateways on network")]
|
|
NoGatewaysOnNetwork,
|
|
|
|
#[error("List of nym apis is empty")]
|
|
ListOfNymApisIsEmpty,
|
|
|
|
#[error("The current network topology seem to be insufficient to route any packets through")]
|
|
InsufficientNetworkTopology(#[from] NymTopologyError),
|
|
|
|
#[error("experienced a failure with our reply surb persistent storage: {source}")]
|
|
SurbStorageError {
|
|
source: Box<dyn Error + Send + Sync>,
|
|
},
|
|
|
|
#[error("experienced a failure with our cryptographic keys persistent storage: {source}")]
|
|
KeyStoreError {
|
|
source: Box<dyn Error + Send + Sync>,
|
|
},
|
|
|
|
#[error("experienced a failure with our gateway details storage: {source}")]
|
|
GatewayDetailsStoreError {
|
|
source: Box<dyn Error + Send + Sync>,
|
|
},
|
|
|
|
#[error("The gateway id is invalid - {0}")]
|
|
UnableToCreatePublicKeyFromGatewayId(Ed25519RecoveryError),
|
|
|
|
#[error("The gateway is malformed: {source}")]
|
|
MalformedGateway {
|
|
#[from]
|
|
source: GatewayConversionError,
|
|
},
|
|
|
|
#[error("failed to establish connection to gateway: {source}")]
|
|
GatewayConnectionFailure {
|
|
#[from]
|
|
source: tungstenite::Error,
|
|
},
|
|
|
|
#[cfg(target_arch = "wasm32")]
|
|
#[error("failed to establish gateway connection (wasm)")]
|
|
GatewayJsConnectionFailure,
|
|
|
|
#[error("Gateway connection was abruptly closed")]
|
|
GatewayConnectionAbruptlyClosed,
|
|
|
|
#[error("Timed out while trying to establish gateway connection")]
|
|
GatewayConnectionTimeout,
|
|
|
|
#[error("No ping measurements for the gateway ({identity}) performed")]
|
|
NoGatewayMeasurements { identity: String },
|
|
|
|
#[error("failed to register receiver for reconstructed mixnet messages")]
|
|
FailedToRegisterReceiver,
|
|
|
|
#[error("Unexpected exit")]
|
|
UnexpectedExit,
|
|
|
|
#[error(
|
|
"This operation would have resulted in clients keys being overwritten without permission"
|
|
)]
|
|
ForbiddenKeyOverwrite,
|
|
|
|
#[error("gateway details are unavailable")]
|
|
UnavailableGatewayDetails {
|
|
source: Box<dyn Error + Send + Sync>,
|
|
},
|
|
|
|
#[error("gateway shared key is unavailable whilst we have full node information")]
|
|
UnavailableSharedKey,
|
|
|
|
#[error("attempted to obtain fresh gateway details whilst already knowing about one")]
|
|
UnexpectedGatewayDetails,
|
|
|
|
#[error("the provided gateway details (for gateway {gateway_id}) do not correspond to the shared keys")]
|
|
MismatchedGatewayDetails { gateway_id: String },
|
|
|
|
#[error("unable to upgrade config file to `{new_version}`")]
|
|
UnableToUpgradeConfigFile { new_version: String },
|
|
|
|
#[error("the provided gateway details don't much the stored data")]
|
|
MismatchedStoredGatewayDetails,
|
|
|
|
#[error("custom selection of gateway was expected")]
|
|
CustomGatewaySelectionExpected,
|
|
|
|
#[error("the persisted gateway details were set for a custom setup")]
|
|
UnexpectedPersistedCustomGatewayDetails,
|
|
|
|
#[error("this client has performed gateway initialisation in another session")]
|
|
NoInitClientPresent,
|
|
|
|
#[error("there are no gateways supporting the wss protocol available")]
|
|
NoWssGateways,
|
|
|
|
#[error("the specified gateway '{gateway}' does not support the wss protocol")]
|
|
UnsupportedWssProtocol { gateway: String },
|
|
}
|
|
|
|
/// Set of messages that the client can send to listeners via the task manager
|
|
#[derive(thiserror::Error, Debug)]
|
|
pub enum ClientCoreStatusMessage {
|
|
// NOTE: The nym-connect frontend listens for these strings, so don't change them until we have a more robust mechanism in place
|
|
#[error("The connected gateway is slow, or the connection to it is slow")]
|
|
GatewayIsSlow,
|
|
// NOTE: The nym-connect frontend listens for these strings, so don't change them until we have a more robust mechanism in place
|
|
#[error("The connected gateway is very slow, or the connection to it is very slow")]
|
|
GatewayIsVerySlow,
|
|
}
|