1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
pub use self::{addressing::*, constants::*, types::*};
pub(crate) mod addressing;
pub(crate) mod constants {
pub const MAX_INCOMING_CLIENT: usize = 256;
pub const MAX_EVENT: usize = 1024;
pub const DIFFICULTY_PREFIX: &str = "00";
pub const INITIAL_POW_DIFFICULTY: [u8; 32] = [
0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0,
];
pub const INITIAL_POS_DIFFICULTY: [u8; 32] = [1; 32];
pub const MAINNET_PORT: u16 = 9090;
pub const TESTNET_PORT: u16 = 9091;
}
pub(crate) mod types {
use libp2p::core::{muxing::StreamMuxerBox, transport::Boxed};
pub use libp2p::{
dns::{GenDnsConfig, TokioDnsConfig},
noise::{AuthenticKeypair as AuthenticNoiseKeypair, NoiseError},
tcp::{GenTcpConfig, GenTcpTransport, TokioTcpTransport},
};
pub type AuthNoiseKeys = AuthenticNoiseKeypair<NoiseSpec>;
pub type BoxedTransport = Boxed<(PeerId, StreamMuxerBox)>;
pub type KademliaMS = libp2p::kad::Kademlia<libp2p::kad::store::MemoryStore>;
pub type NetworkAddress = libp2p::Multiaddr;
pub type NoiseKeys = libp2p::noise::Keypair<NoiseSpec>;
pub type NoiseResult<T = AuthNoiseKeys> = Result<T, NoiseError>;
pub type NoiseSpec = libp2p::noise::X25519Spec;
pub type PeerId = libp2p::PeerId;
pub type PeerKp = libp2p::identity::Keypair;
pub type P2PTransport = (PeerId, libp2p::core::muxing::StreamMuxerBox);
}