extensions_sv2/lib.rs
1//! # Stratum V2 Extensions Messages Crate.
2//!
3//! This crate defines extension messages for Stratum V2 protocol.
4//!
5//! ## Extensions Supported
6//!
7//! - **Extensions Negotiation** (extension_type=0x0001): Allows endpoints to negotiate
8//! which optional extensions are supported during connection setup.
9//! - **Worker-Specific Hashrate Tracking** (extension_type=0x0002): Enables tracking per-worker hashrates
10//! within extended channels via TLV fields.
11//!
12//! ## Architecture
13//!
14//! The crate is organized into:
15//! - `extensions_negotiation`: Extension negotiation protocol
16//! - `worker_specific_hashrate_tracking`: Worker-Specific Hashrate Tracking extension
17//!
18//! TLV encoding/decoding utilities are provided by the `parsers_sv2` crate.
19//!
20//! For further information about the extensions, please refer to:
21//! - [Extensions Negotiation Spec](https://github.com/stratum-mining/sv2-spec/blob/main/extensions/extensions-negotiation.md)
22//! - [Worker-Specific Hashrate Tracking Spec](https://github.com/stratum-mining/sv2-spec/blob/main/extensions/worker-specific-hashrate-tracking.md)
23
24#![no_std]
25
26extern crate alloc;
27
28// Extensions Negotiation (0x0001)
29pub mod extensions_negotiation;
30
31// Worker-Specific Hashrate Tracking (0x0002)
32pub mod worker_specific_hashrate_tracking;
33
34// Re-export commonly used items from extensions_negotiation
35pub use extensions_negotiation::{
36 RequestExtensions, RequestExtensionsError, RequestExtensionsSuccess,
37 CHANNEL_BIT_REQUEST_EXTENSIONS, CHANNEL_BIT_REQUEST_EXTENSIONS_ERROR,
38 CHANNEL_BIT_REQUEST_EXTENSIONS_SUCCESS,
39 EXTENSION_TYPE as EXTENSION_TYPE_EXTENSIONS_NEGOTIATION, MESSAGE_TYPE_REQUEST_EXTENSIONS,
40 MESSAGE_TYPE_REQUEST_EXTENSIONS_ERROR, MESSAGE_TYPE_REQUEST_EXTENSIONS_SUCCESS,
41};
42
43// Re-export commonly used items from worker_specific_hashrate_tracking
44pub use worker_specific_hashrate_tracking::{
45 UserIdentity, EXTENSION_TYPE as EXTENSION_TYPE_WORKER_HASHRATE_TRACKING,
46 FIELD_TYPE_USER_IDENTITY as TLV_FIELD_TYPE_USER_IDENTITY, MAX_USER_IDENTITY_LENGTH,
47};