pub struct P2pConfig {
pub db_dir: PathBuf,
pub peer: Peer,
pub allowlist: Vec<Peer>,
pub blocklist: Vec<IpAddr>,
pub allow_peer_list: Vec<PeerId>,
pub block_peer_list: Vec<PeerId>,
pub permission: bool,
pub only_stable_data: bool,
pub delivery_length: usize,
}
Expand description
Chammomile Configs.
Fields§
§db_dir: PathBuf
Default Data saved directory.
peer: Peer
Default binding multiaddr string. Example: “/ip4/0.0.0.0/quic/7364”
allowlist: Vec<Peer>
Allowed MultiAddr style peer list.
blocklist: Vec<IpAddr>
Blocked Ip’s list.
allow_peer_list: Vec<PeerId>
Allowed peer’s PeerId
list.
block_peer_list: Vec<PeerId>
Blocked peers’s PeerId
list.
permission: bool
If set permission is true, that server is permissioned,
not receive DHT’s peer message, only stable connect.
if set permission is false, that server is permissionless,
receive DHT’s peer message and stable’s peer message.
if you use a permissionless server, but only receive stable’s message,
you can set only_stable_data
is true.
Recommend use permission = false & only_stable_data = true
replace permissioned.
only_stable_data: bool
If only_stable_data
is true, only receive stable connected peer’s data.
delivery_length: usize
When delivery feedback has set length, it will split length of data to return.
For example. set delivery_length = 8
,
and when a Data(1u64, PeerId, vec![1u8, 2u8, ..., 100u8]), if send success, will return:
Delivery(DeliveryType::Data, 1u64, true, vec![1u8, 2u8, …, 8u8])if send failure, will return:
Delivery(DeliveryType::Data, 1u64, false, vec![1u8, 2u8, …, 8u8])`