The previous .git directory was found gutted (only info/ remained), so history is unrecoverable locally. This commit restores version control with the tree exactly as it stands: the working app, the preview-tracks launcher on the artist hero, the scrollable-track-previews design bundle (docs + approved mockups), and the Phase 0 validation artifacts.
32 lines
1.1 KiB
Rust
32 lines
1.1 KiB
Rust
//! Soulseek protocol messages and binary codecs.
|
|
//!
|
|
//! Wire format: every message is `[u32 length][code][payload]`, little-endian
|
|
//! throughout. Server and peer messages use a `u32` code; connection
|
|
//! initialization messages (PeerInit / PierceFirewall) use a single-byte code.
|
|
//! Strings are `[u32 len][bytes]`, UTF-8 with Latin-1 fallback on decode.
|
|
//! Search responses and browse payloads are zlib-compressed after the code.
|
|
//!
|
|
//! Reference: Soulseek.NET `src/Messaging/**` and the Nicotine+ protocol docs.
|
|
|
|
pub mod dist;
|
|
pub mod peer;
|
|
pub mod server;
|
|
pub mod types;
|
|
pub mod wire;
|
|
|
|
#[derive(Debug, thiserror::Error)]
|
|
pub enum ProtoError {
|
|
#[error("message payload ended unexpectedly")]
|
|
UnexpectedEof,
|
|
#[error("zlib decompression failed: {0}")]
|
|
Zlib(#[from] std::io::Error),
|
|
#[error("message too large: {0} bytes")]
|
|
TooLarge(usize),
|
|
}
|
|
|
|
pub type Result<T> = std::result::Result<T, ProtoError>;
|
|
|
|
/// Sanity cap on a single message frame (search responses from big shares
|
|
/// run a few hundred KB; browse responses can reach tens of MB).
|
|
pub const MAX_MESSAGE_SIZE: usize = 64 * 1024 * 1024;
|