Update SDK modules for &mut self and clippy fixes
This commit is contained in:
@@ -16,7 +16,7 @@ async fn main() {
|
||||
let our_address = *client.nym_address();
|
||||
println!("Our client nym address is: {our_address}");
|
||||
|
||||
let sender = client.split_sender();
|
||||
let mut sender = client.split_sender();
|
||||
|
||||
// receiving task
|
||||
let receiving_task_handle = tokio::spawn(async move {
|
||||
|
||||
@@ -29,6 +29,7 @@ where
|
||||
St: Storage + Clone,
|
||||
<St as Storage>::StorageError: Send + Sync + 'static,
|
||||
{
|
||||
#[allow(clippy::result_large_err)]
|
||||
pub(crate) fn new(
|
||||
network_details: NymNetworkDetails,
|
||||
mnemonic: String,
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
use nym_validator_client::nyxd::error::NyxdError;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use nym_ip_packet_requests::v8::response::{ConnectFailureReason, IpPacketResponseData};
|
||||
use nym_validator_client::nym_api::error::NymAPIError;
|
||||
|
||||
/// Top-level Error enum for the mixnet client and its relevant types.
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum Error {
|
||||
@@ -99,6 +102,63 @@ pub enum Error {
|
||||
|
||||
#[error("Failed to get shutdown tracker from the task runtime registry: {0}")]
|
||||
RegistryAccess(#[from] nym_task::RegistryAccessError),
|
||||
#[error("nymsphinx receiver error: {0}")]
|
||||
MessageRecovery(#[from] nym_sphinx::receiver::MessageRecoveryError),
|
||||
|
||||
#[error("client not connected")]
|
||||
IprStreamClientNotConnected,
|
||||
|
||||
#[error("client already connected or connecting")]
|
||||
IprStreamClientAlreadyConnectedOrConnecting,
|
||||
|
||||
#[error("trying to send an anonymous reply but peer surb tag is not set")]
|
||||
MixStreamSurbTagNotSet,
|
||||
|
||||
#[error("trying to send an outgoing message but receipient address is not set")]
|
||||
MixStreamRecipientNotSet,
|
||||
|
||||
#[error("listening for connection response timed out")]
|
||||
IPRConnectResponseTimeout,
|
||||
|
||||
#[error("no next frame: assuming stream is closed")]
|
||||
IPRClientStreamClosed,
|
||||
|
||||
#[error("expected control response, got {0:?}")]
|
||||
UnexpectedResponseType(IpPacketResponseData),
|
||||
|
||||
#[error("connect denied: {0:?}")]
|
||||
ConnectDenied(ConnectFailureReason),
|
||||
|
||||
#[allow(clippy::result_large_err)]
|
||||
#[error("api directory error: {0}")]
|
||||
GatewayDirectoryError(#[from] NymAPIError),
|
||||
|
||||
#[error("did not receive Validator endpoint details")]
|
||||
NoValidatorDetailsAvailable,
|
||||
|
||||
#[error("did not receive URL")]
|
||||
NoValidatorAPIUrl,
|
||||
|
||||
#[error("did not receive NymVPN API URL")]
|
||||
NoNymAPIUrl,
|
||||
|
||||
#[error("no available gateway")]
|
||||
NoGatewayAvailable,
|
||||
|
||||
#[error("no IPR address on selected gateway")]
|
||||
NoIPRAvailable,
|
||||
|
||||
#[error("message version check failed: {0}")]
|
||||
IPRMessageVersionCheckFailed(String),
|
||||
|
||||
#[error("no response id found in connect response")]
|
||||
IPRNoId,
|
||||
|
||||
#[error("Could not find peer address or surb tag")]
|
||||
MixStreamNoPeerOrSurb,
|
||||
|
||||
#[error("No network env specified on new MixStream")]
|
||||
MissingStreamConfig,
|
||||
}
|
||||
|
||||
impl Error {
|
||||
|
||||
@@ -340,6 +340,7 @@ where
|
||||
}
|
||||
|
||||
/// Construct a [`DisconnectedMixnetClient`] from the setup specified.
|
||||
#[allow(clippy::result_large_err)]
|
||||
pub fn build(self) -> Result<DisconnectedMixnetClient<S>> {
|
||||
let mut client = DisconnectedMixnetClient::new(
|
||||
self.config,
|
||||
@@ -445,6 +446,7 @@ where
|
||||
/// Callers have the option of supplying further parameters to:
|
||||
/// - store persistent identities at a location on-disk, if desired;
|
||||
/// - use SOCKS5 mode
|
||||
#[allow(clippy::result_large_err)]
|
||||
fn new(
|
||||
config: Config,
|
||||
socks5_config: Option<Socks5>,
|
||||
|
||||
@@ -53,6 +53,7 @@ impl StoragePaths {
|
||||
///
|
||||
/// This function will return an error if it is passed a path to an existing file instead of a
|
||||
/// directory.
|
||||
#[allow(clippy::result_large_err)]
|
||||
pub fn new_from_dir<P: AsRef<Path>>(dir: P) -> Result<Self> {
|
||||
let dir = dir.as_ref();
|
||||
if dir.is_file() {
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
//! let codec = BytesCodec::new();
|
||||
//! let mut framed_read = FramedRead::new(read, codec);
|
||||
//! // Much like the tcpstream, split our Nym client into a sender and receiver for concurrent read/write
|
||||
//! let sender = client.split_sender();
|
||||
//! let mut sender = client.split_sender();
|
||||
//! // The server / service provider address our client is sending messages to will remain static
|
||||
//! let server_addr = server_address;
|
||||
//! // Store outgoing messages in instance of Dashset abstraction
|
||||
|
||||
@@ -161,7 +161,7 @@ impl NymProxyClient {
|
||||
let codec = BytesCodec::new();
|
||||
let mut framed_read = FramedRead::new(read, codec);
|
||||
// Much like the tcpstream, split our Nym client into a sender and receiver for concurrent read/write
|
||||
let sender = client.split_sender();
|
||||
let mut sender = client.split_sender();
|
||||
// The server / service provider address our client is sending messages to will remain static
|
||||
let server_addr = server_address;
|
||||
// Store outgoing messages in instance of Dashset abstraction
|
||||
|
||||
@@ -217,7 +217,7 @@ impl NymProxyServer {
|
||||
sender
|
||||
.write()
|
||||
.await
|
||||
.send_reply(surb, bincode::serialize(&reply)?)
|
||||
.send_reply(surb, &bincode::serialize(&reply)?)
|
||||
.await?
|
||||
}
|
||||
info!(
|
||||
|
||||
Reference in New Issue
Block a user