aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs27
1 files changed, 8 insertions, 19 deletions
diff --git a/src/lib.rs b/src/lib.rs
index bc62d78..e3ad197 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -46,6 +46,10 @@ mod errors {
pub use errors::*;
// Organize code internally (files, modules), but pull it all into a flat namespace to export.
+mod helpers;
+pub use helpers::*;
+mod bitfield;
+pub use bitfield::*;
mod sleep_file;
pub use sleep_file::*;
mod sleep_register;
@@ -56,25 +60,10 @@ mod protocol;
pub use protocol::*;
pub mod network_msgs;
pub mod metadata_msgs;
-mod node;
-pub use node::*;
mod discovery;
pub use discovery::*;
-
-// Shared functions
-use crypto::digest::Digest;
-use crypto::blake2b::Blake2b;
-
-/// Helper to calculate a discovery key from a public key. 'key' should be 32 bytes; the returned
-/// array will also be 32 bytes long.
-///
-/// dat discovery keys are calculated as a BLAKE2b "keyed hash" (using the passed key) of the string
-/// "hypercore" (with no trailing null byte).
-pub fn make_discovery_key(key: &[u8]) -> Vec<u8> {
- let mut discovery_key = [0; 32];
- let mut hash = Blake2b::new_keyed(32, key);
- hash.input(&"hypercore".as_bytes());
- hash.result(&mut discovery_key);
- discovery_key.to_vec()
-}
+mod peer;
+pub use peer::*;
+mod synchronizer;
+pub use synchronizer::*;