mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
feat(cli): add max peer args (#4024)
This commit is contained in:
@ -1134,11 +1134,29 @@ impl PeersConfig {
|
||||
self.connection_info.num_inbound = num_inbound;
|
||||
self
|
||||
}
|
||||
|
||||
/// Maximum allowed outbound connections.
|
||||
pub fn with_max_outbound(mut self, max_outbound: usize) -> Self {
|
||||
self.connection_info.max_outbound = max_outbound;
|
||||
self
|
||||
}
|
||||
|
||||
/// Maximum allowed inbound connections with optional update.
|
||||
pub fn with_max_inbound_opt(mut self, max_inbound: Option<usize>) -> Self {
|
||||
if let Some(max_inbound) = max_inbound {
|
||||
self.connection_info.max_inbound = max_inbound;
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
/// Maximum allowed outbound connections with optional update.
|
||||
pub fn with_max_outbound_opt(mut self, max_outbound: Option<usize>) -> Self {
|
||||
if let Some(max_outbound) = max_outbound {
|
||||
self.connection_info.max_outbound = max_outbound;
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
/// Maximum allowed inbound connections.
|
||||
pub fn with_max_inbound(mut self, max_inbound: usize) -> Self {
|
||||
self.connection_info.max_inbound = max_inbound;
|
||||
|
||||
Reference in New Issue
Block a user