mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-08 22:28:12 -05:00
bin/lilith: DEP-0006: manually add app identifier for each p2p network in lilith config
This commit is contained in:
@@ -20,6 +20,7 @@ rpc_listen = "tcp://127.0.0.1:18927"
|
||||
#seeds = []
|
||||
#peers = []
|
||||
#version = "0.5.0"
|
||||
#app_name = "darkfid"
|
||||
#localnet = false
|
||||
#hostlist ="~/.local/share/darkfi/lilith/darkfid_sync/hostlist.tsv"
|
||||
#datastore = "~/.local/share/darkfi/lilith/darkfid_sync"
|
||||
@@ -30,6 +31,7 @@ rpc_listen = "tcp://127.0.0.1:18927"
|
||||
#seeds = []
|
||||
#peers = []
|
||||
#version = "0.5.1"
|
||||
#app_name = "darkirc"
|
||||
#localnet = false
|
||||
#datastore = "~/.local/share/darkfi/lilith/darkirc"
|
||||
#hostlist ="~/.local/share/darkfi/lilith/darkirc/hostlist.tsv"
|
||||
@@ -40,6 +42,7 @@ rpc_listen = "tcp://127.0.0.1:18927"
|
||||
#seeds = []
|
||||
#peers = []
|
||||
#version = "0.5.0"
|
||||
#app_name = "taud"
|
||||
#localnet = false
|
||||
#datastore = "~/.local/share/darkfi/lilith/taud"
|
||||
#hostlist ="~/.local/share/darkfi/lilith/taud/hostlist.tsv"
|
||||
|
||||
@@ -149,6 +149,8 @@ struct NetInfo {
|
||||
pub peers: Vec<Url>,
|
||||
/// Supported network version
|
||||
pub version: Version,
|
||||
/// App Identifier for the app running on the network
|
||||
pub app_name: String,
|
||||
/// Enable localnet hosts
|
||||
pub localnet: bool,
|
||||
/// Path to P2P datastore
|
||||
@@ -328,6 +330,12 @@ fn parse_configured_networks(data: &str) -> Result<HashMap<String, NetInfo>> {
|
||||
semver::Version::parse(option_env!("CARGO_PKG_VERSION").unwrap_or("0.0.0"))?
|
||||
};
|
||||
|
||||
let app_name = if table.contains_key("app_name") {
|
||||
table["app_name"].as_str().unwrap().to_string()
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
|
||||
let datastore: String = table["datastore"].as_str().unwrap().to_string();
|
||||
|
||||
let hostlist: String = table["hostlist"].as_str().unwrap().to_string();
|
||||
@@ -346,6 +354,7 @@ fn parse_configured_networks(data: &str) -> Result<HashMap<String, NetInfo>> {
|
||||
seeds,
|
||||
peers,
|
||||
version,
|
||||
app_name,
|
||||
localnet,
|
||||
datastore,
|
||||
hostlist,
|
||||
@@ -377,6 +386,7 @@ async fn spawn_net(name: String, info: &NetInfo, ex: Arc<Executor<'static>>) ->
|
||||
outbound_connect_timeout: 30,
|
||||
inbound_connections: 512,
|
||||
app_version: info.version.clone(),
|
||||
app_name: info.app_name.clone(),
|
||||
localnet: info.localnet,
|
||||
p2p_datastore: Some(info.datastore.clone()),
|
||||
hostlist: Some(info.hostlist.clone()),
|
||||
|
||||
Reference in New Issue
Block a user