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
//! ## Introduction
//!
//! Hypercore protocol is a streaming, message based protocol. This is a rust port of the wire
//! protocol implementation in [the original Javascript version][holepunch-hypercore] aiming
//! for interoperability with LTS version.
//!
//! This crate is built on top of the [hypercore](https://crates.io/crates/hypercore) crate, which defines some structs used here.
//!
//! ## Design
//!
//! This crate expects to receive a pre-encrypted, message-framed connection (e.g., from hyperswarm).
//! The underlying stream should implement `Stream<Item = Vec<u8>> + Sink<Vec<u8>>`.
//!
//! After construction, each side can request any number of channels on the protocol. A
//! channel is opened with a [Key], a 32 byte buffer. Channels are only opened if both peers
//! opened a channel for the same key. It is automatically verified that both parties know the
//! key without transmitting the key itself using the handshake hash from the underlying connection.
//!
//! On a channel, the predefined messages, including a custom Extension message, of the Hypercore
//! protocol can be sent and received.
//!
//! [holepunch-hypercore]: https://github.com/holepunchto/hypercore
/// The wire messages used by the protocol.
pub use Error;
pub use Channel;
// Export the needed types for Channel::take_receiver, and Channel::local_sender()
pub use ;
pub use Message;
pub use ;
pub use BoxedStream;
pub use discovery_key;
// Export handshake result for constructing Protocol
pub use HandshakeResult;