mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-22 06:11:34 +00:00
*: Derive Debug
and Clone
(#2495)
Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
@ -102,7 +102,7 @@ enum IncomingRelayReq {
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct RelayConfig {
|
||||
/// How long to keep connections alive when they're idle.
|
||||
///
|
||||
|
@ -37,6 +37,7 @@ use std::fmt;
|
||||
use std::task::{Context, Poll};
|
||||
use std::time::Duration;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct RelayHandlerConfig {
|
||||
pub connection_idle_timeout: Duration,
|
||||
}
|
||||
|
@ -61,6 +61,28 @@ pub struct Config {
|
||||
pub circuit_src_rate_limiters: Vec<Box<dyn rate_limiter::RateLimiter>>,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for Config {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("Config")
|
||||
.field("max_reservations", &self.max_reservations)
|
||||
.field("max_reservations_per_peer", &self.max_reservations_per_peer)
|
||||
.field("reservation_duration", &self.reservation_duration)
|
||||
.field(
|
||||
"reservation_rate_limiters",
|
||||
&format!("[{} rate limiters]", self.reservation_rate_limiters.len()),
|
||||
)
|
||||
.field("max_circuits", &self.max_circuits)
|
||||
.field("max_circuits_per_peer", &self.max_circuits_per_peer)
|
||||
.field("max_circuit_duration", &self.max_circuit_duration)
|
||||
.field("max_circuit_bytes", &self.max_circuit_bytes)
|
||||
.field(
|
||||
"circuit_src_rate_limiters",
|
||||
&format!("[{} rate limiters]", self.circuit_src_rate_limiters.len()),
|
||||
)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
fn default() -> Self {
|
||||
let reservation_rate_limiters = vec![
|
||||
|
@ -44,6 +44,7 @@ use std::fmt;
|
||||
use std::task::{Context, Poll};
|
||||
use std::time::Duration;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Config {
|
||||
pub reservation_duration: Duration,
|
||||
pub max_circuit_duration: Duration,
|
||||
|
@ -84,7 +84,7 @@ mod generic {
|
||||
}
|
||||
|
||||
/// Configuration for a [`RateLimiter`].
|
||||
#[derive(Clone, Copy)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct RateLimiterConfig {
|
||||
/// The maximum number of tokens in the bucket at any point in time.
|
||||
pub limit: NonZeroU32,
|
||||
|
Reference in New Issue
Block a user