2016-11-30 07:01:11 -08:00
|
|
|
use std::{net, path};
|
2017-08-08 02:17:36 -07:00
|
|
|
use message::common::Services;
|
2016-10-04 03:33:23 -07:00
|
|
|
use net::Config as NetConfig;
|
2016-11-30 07:01:11 -08:00
|
|
|
use util::InternetProtocol;
|
2016-10-04 03:33:23 -07:00
|
|
|
|
2016-11-30 07:01:11 -08:00
|
|
|
#[derive(Debug, Clone)]
|
2016-10-04 03:33:23 -07:00
|
|
|
pub struct Config {
|
2016-10-17 16:44:52 -07:00
|
|
|
/// Number of threads used by p2p thread pool.
|
|
|
|
pub threads: usize,
|
|
|
|
/// Number of inbound connections.
|
2016-11-02 16:22:00 -07:00
|
|
|
pub inbound_connections: u32,
|
2016-10-17 16:44:52 -07:00
|
|
|
/// Number of outbound connections.
|
2016-11-02 16:22:00 -07:00
|
|
|
pub outbound_connections: u32,
|
2016-10-04 03:33:23 -07:00
|
|
|
/// Configuration for every connection.
|
|
|
|
pub connection: NetConfig,
|
2018-05-03 03:08:33 -07:00
|
|
|
/// Connect only to these nodes.
|
2016-11-30 07:01:11 -08:00
|
|
|
pub peers: Vec<net::SocketAddr>,
|
2016-10-17 16:44:52 -07:00
|
|
|
/// Connect to these nodes to retrieve peer addresses, and disconnect.
|
2016-10-25 00:55:43 -07:00
|
|
|
pub seeds: Vec<String>,
|
2017-08-08 02:17:36 -07:00
|
|
|
/// p2p/nodes.csv file path.
|
2016-11-30 07:01:11 -08:00
|
|
|
pub node_table_path: path::PathBuf,
|
2019-02-02 14:35:00 -08:00
|
|
|
/// Peers with these services will get a boost in node_table.
|
2017-08-08 02:17:36 -07:00
|
|
|
pub preferable_services: Services,
|
2016-11-30 07:01:11 -08:00
|
|
|
/// Internet protocol.
|
|
|
|
pub internet_protocol: InternetProtocol,
|
2016-10-04 03:33:23 -07:00
|
|
|
}
|