-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
103 additions
and
12 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,12 @@ | ||
//! cuprated config | ||
use serde::{Deserialize, Serialize}; | ||
|
||
mod sections; | ||
|
||
use sections::P2PConfig; | ||
|
||
#[derive(Default, Deserialize, Serialize)] | ||
#[serde(deny_unknown_fields, default)] | ||
pub struct Config { | ||
p2p: P2PConfig, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
use cuprate_address_book::AddressBookConfig; | ||
use cuprate_p2p_core::ClearNetServerCfg; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Default, Deserialize, Serialize)] | ||
#[serde(deny_unknown_fields, default)] | ||
pub struct P2PConfig { | ||
clear_net: ClearNetConfig, | ||
} | ||
|
||
#[derive(Default, Deserialize, Serialize)] | ||
#[serde(deny_unknown_fields, default)] | ||
pub struct ClearNetConfig { | ||
server: ClearNetServerCfg, | ||
#[serde(flatten)] | ||
flattened: SharedNetConfig, | ||
} | ||
|
||
#[derive(Deserialize, Serialize)] | ||
#[serde(deny_unknown_fields, default)] | ||
pub struct SharedNetConfig { | ||
/// The number of outbound connections to make and try keep. | ||
pub outbound_connections: usize, | ||
/// The amount of extra connections we can make if we are under load from the rest of Cuprate. | ||
pub extra_outbound_connections: usize, | ||
/// The maximum amount of inbound connections | ||
pub max_inbound_connections: usize, | ||
/// port to use to accept p2p connections. | ||
pub p2p_port: u16, | ||
/// The address book config. | ||
pub address_book_config: AddressBookConfig, | ||
} | ||
|
||
impl Default for SharedNetConfig { | ||
fn default() -> Self { | ||
Self { | ||
outbound_connections: 32, | ||
extra_outbound_connections: 8, | ||
max_inbound_connections: 128, | ||
p2p_port: 18080, | ||
address_book_config: AddressBookConfig::default(), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters