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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
//! # dig-peer-protocol
//!
//! DIG Network L2 protocol types — a superset of `chia-protocol`.
//!
//! This crate re-exports the entire Chia protocol ecosystem (`chia-protocol`,
//! `chia-sdk-client`, `chia-ssl`, `chia-traits`) plus DIG's own extensions: the
//! `200..=222` opcode band, the [`DigMessage`] framing that can express it, and
//! [`DigLink`], the websocket peer link that carries it. Consumers depend on
//! `dig-peer-protocol` alone instead of importing multiple `chia-*` crates individually.
//!
//! ## The closed-enum problem, and how this crate closes it
//!
//! `chia_protocol::Message` stores its opcode as `ProtocolMessageTypes`, an enum that stops
//! at `RespondCostInfo = 107` with no `Unknown(u8)`. A DIG opcode has no value in that enum, so
//! it is neither constructible nor decodable through it — and worse, `chia-sdk-client`'s
//! receive loop calls `Message::from_bytes`, so one inbound DIG frame drops the whole
//! connection rather than that one frame.
//!
//! [`DigMessage`] answers the first half: the same wire bytes with a raw `u8` opcode.
//! [`DigLink`] answers the second: a websocket link that frames `DigMessage` end to end.
//! Together they replace the vendored `chia-protocol` / `chia-sdk-client` forks DIG used to
//! carry, so `chia-protocol` is an ordinary dependency with no `[patch.crates-io]`.
//!
//! ## What's included
//!
//! | Source crate | What's re-exported |
//! |-------------|-------------------|
//! | `chia-protocol` | All wire types: `Message`, `Handshake`, `ProtocolMessageTypes`, `NodeType`, etc. |
//! | `chia-sdk-client` | `Peer`, `Client`, `ClientError`, `ClientState`, `Network`, `PeerOptions`, rate limiting, TLS connectors |
//! | `chia-ssl` | `ChiaCertificate` |
//! | `chia-traits` | `Streamable` trait |
//! | `chia_streamable_macro` | `#[streamable]` proc macro |
//! | **DIG extensions** | `DigMessage`, `DigMessageType`, the `200..=222` opcode band, `RegisterPeer`, `RegisterAck`, introducer wire types |
//! | **DIG peer link** | `DigLink`, `LinkOptions`, `LinkError`, `Admission`, `OpcodeRateLimiter`, `OpcodeRateLimits` |
//!
//! ## Feature flags
//!
//! | Flag | Forwards to | Effect |
//! |------|-------------|--------|
//! | `native-tls` | `chia-sdk-client/native-tls` | OS-native TLS; enables `Client`, `ClientState`, `Connector`, `create_native_tls_connector`, `DigLink::connect` |
//! | `rustls` | `chia-sdk-client/rustls` | Pure-Rust TLS; enables `Client`, `ClientState`, `Connector`, `create_rustls_connector`, `DigLink::connect` |
//!
//! Neither feature is enabled by default. The crate builds without either but TLS-dependent
//! items (`Client`, `ClientState`, `Connector`, and `DigLink::connect`) become unavailable;
//! [`DigLink::from_websocket`] and [`DigLink::from_server_websocket`] stay available, since
//! adopting an already-established socket needs no TLS backend of its own.
// ============================================================================
// Re-export: chia-protocol (all wire types)
// ============================================================================
pub use *;
// ============================================================================
// Re-export: chia-sdk-client (peer IO, TLS, rate limiting)
// ============================================================================
// Backend-agnostic types — always available.
pub use ;
// `Client`, `ClientState`, and `Connector` require a TLS backend in `chia-sdk-client`.
// Enable either the `native-tls` or `rustls` feature to use them.
pub use ;
pub use create_native_tls_connector;
pub use create_rustls_connector;
// ============================================================================
// Re-export: chia-ssl (certificate types)
// ============================================================================
pub use ChiaCertificate;
// ============================================================================
// Re-export: chia-traits (serialization)
// ============================================================================
pub use Streamable;
// ============================================================================
// Re-export: chia_streamable_macro (proc macro for wire structs)
// ============================================================================
pub use streamable;
// ============================================================================
// DIG extensions
// ============================================================================
pub use DigMessage;
pub use ;
pub use LinkError;
pub use ;
pub use ;
pub use ;
pub use ;