mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-09 22:57:59 -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 = []
|
#seeds = []
|
||||||
#peers = []
|
#peers = []
|
||||||
#version = "0.5.0"
|
#version = "0.5.0"
|
||||||
|
#app_name = "darkfid"
|
||||||
#localnet = false
|
#localnet = false
|
||||||
#hostlist ="~/.local/share/darkfi/lilith/darkfid_sync/hostlist.tsv"
|
#hostlist ="~/.local/share/darkfi/lilith/darkfid_sync/hostlist.tsv"
|
||||||
#datastore = "~/.local/share/darkfi/lilith/darkfid_sync"
|
#datastore = "~/.local/share/darkfi/lilith/darkfid_sync"
|
||||||
@@ -30,6 +31,7 @@ rpc_listen = "tcp://127.0.0.1:18927"
|
|||||||
#seeds = []
|
#seeds = []
|
||||||
#peers = []
|
#peers = []
|
||||||
#version = "0.5.1"
|
#version = "0.5.1"
|
||||||
|
#app_name = "darkirc"
|
||||||
#localnet = false
|
#localnet = false
|
||||||
#datastore = "~/.local/share/darkfi/lilith/darkirc"
|
#datastore = "~/.local/share/darkfi/lilith/darkirc"
|
||||||
#hostlist ="~/.local/share/darkfi/lilith/darkirc/hostlist.tsv"
|
#hostlist ="~/.local/share/darkfi/lilith/darkirc/hostlist.tsv"
|
||||||
@@ -40,6 +42,7 @@ rpc_listen = "tcp://127.0.0.1:18927"
|
|||||||
#seeds = []
|
#seeds = []
|
||||||
#peers = []
|
#peers = []
|
||||||
#version = "0.5.0"
|
#version = "0.5.0"
|
||||||
|
#app_name = "taud"
|
||||||
#localnet = false
|
#localnet = false
|
||||||
#datastore = "~/.local/share/darkfi/lilith/taud"
|
#datastore = "~/.local/share/darkfi/lilith/taud"
|
||||||
#hostlist ="~/.local/share/darkfi/lilith/taud/hostlist.tsv"
|
#hostlist ="~/.local/share/darkfi/lilith/taud/hostlist.tsv"
|
||||||
|
|||||||
@@ -149,6 +149,8 @@ struct NetInfo {
|
|||||||
pub peers: Vec<Url>,
|
pub peers: Vec<Url>,
|
||||||
/// Supported network version
|
/// Supported network version
|
||||||
pub version: Version,
|
pub version: Version,
|
||||||
|
/// App Identifier for the app running on the network
|
||||||
|
pub app_name: String,
|
||||||
/// Enable localnet hosts
|
/// Enable localnet hosts
|
||||||
pub localnet: bool,
|
pub localnet: bool,
|
||||||
/// Path to P2P datastore
|
/// 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"))?
|
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 datastore: String = table["datastore"].as_str().unwrap().to_string();
|
||||||
|
|
||||||
let hostlist: String = table["hostlist"].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,
|
seeds,
|
||||||
peers,
|
peers,
|
||||||
version,
|
version,
|
||||||
|
app_name,
|
||||||
localnet,
|
localnet,
|
||||||
datastore,
|
datastore,
|
||||||
hostlist,
|
hostlist,
|
||||||
@@ -377,6 +386,7 @@ async fn spawn_net(name: String, info: &NetInfo, ex: Arc<Executor<'static>>) ->
|
|||||||
outbound_connect_timeout: 30,
|
outbound_connect_timeout: 30,
|
||||||
inbound_connections: 512,
|
inbound_connections: 512,
|
||||||
app_version: info.version.clone(),
|
app_version: info.version.clone(),
|
||||||
|
app_name: info.app_name.clone(),
|
||||||
localnet: info.localnet,
|
localnet: info.localnet,
|
||||||
p2p_datastore: Some(info.datastore.clone()),
|
p2p_datastore: Some(info.datastore.clone()),
|
||||||
hostlist: Some(info.hostlist.clone()),
|
hostlist: Some(info.hostlist.clone()),
|
||||||
|
|||||||
Reference in New Issue
Block a user