Optimizations to the I/O interfaces.
- Use the
Payloadtype on the read and write path. - Take ownership of the garbage and decoy bytes instead of referencing slices.
The "I regret RPIT" release.
- Updating the
io::Protocolandfutures::Protocolinterfaces to use newtypes for the session reader transformation instead of RPIT so that the Protocol types can be named by callers.
Major breaking changes!
- Handshake API Introduced compile-time type safety using the typestate pattern. The handshake now uses typed states (
Initialized,SentKey,ReceivedKey,SentVersion) that prevent out-of-order method calls at compile time. - Crate Feature Flags Removed the
allocfeature flag, simplifying tono_std(core) andstd(I/O) features. Removed thefuturesfeature flag in favor of a singletokiofeature for async support, reflecting real-world usage patterns. - I/O Interfaces Added new synchronous I/O interface (
io::Protocol) alongside the existing async interface (moved tofutures::Protocol). Both interfaces take ownership of underlying I/O readers and writers. - Infallible Serialization The
serialize()function now returnsVec<u8>directly instead ofResult<Vec<u8>, Error>, eliminating unnecessary error handling for in-memory operations.
- Remove error handling from
serialize()calls. - Adapt
AsyncProtocolcode to the newfutures::Protocolinterface which owns the underlying reader and writer. - If using the lower level
handshakeinterface, update code to use the new typed state machine. - If using the lower level
PacketHandlerinterface, update to the newCipherSessioninterface.
- Loosen tokio version restrictions allowing the consumer to dictate the tokio version best for them. The version could effect the MSRV of the library.
- Rename the
asyncfeature tofuturesto better follow ecosystem conventions.
- Switch out the chacha20-poly1305 implementation with the SIMD-enabled rust-bitcoin version.
- Expose underlying packet handler types in
AsyncProtocolso callers can leverage the automatic handshake while maintaining fine grained control of the packet handling. - Pass along more specific I/O errors to caller.
- Replace the ownership-based interface of
AsyncProtocolwith mutable references which fit in the asynchronous ecosystem better. - Add the
tokiofeature flag for easier asynchronous integration if caller is using the Tokio runtime. - Fix a serialization bug in bitcoin network message.
- Adds the
AsyncProtocolhigh level interface for less boilerplate integration when using an async runtime (e.g. Tokio). Codes against thefutures-rstraits, so any runtime which is compatible with those should be supported. - Aync read functions should now be cancellation safe.
- The high level
Iovariant of theProtocolErrorexposes if it is worth retrying with the V1 protocol with the newProtocolFailureSuggestiontype.