Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(noise): modify message framing #4548

Merged
merged 26 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a0b4dc0
refactor(noise): modify message framing
0xcrust Sep 22, 2023
7d4c049
Apply cargo fmt
0xcrust Sep 24, 2023
bbee021
Apply changelog fixes
0xcrust Sep 25, 2023
218ad27
Remove NoiseFramed type and pin-project dependency
0xcrust Sep 26, 2023
d2c46bb
Use distinct Encoder impls for TransportState and SessionState
0xcrust Sep 26, 2023
163d460
Use distinct Decoder impls for TransportState and SessionState
0xcrust Sep 26, 2023
c64f778
Modify encode implementation to take reference
0xcrust Sep 26, 2023
fd77775
Fix clippy warnings
0xcrust Sep 26, 2023
910dd6b
Apply suggestions from code review
0xcrust Sep 27, 2023
659ba79
Apply minor fixes
0xcrust Sep 27, 2023
284f072
Minor fixes
0xcrust Sep 27, 2023
067bc6f
Update transports/noise/src/io/handshake.rs
0xcrust Sep 28, 2023
34c6458
Fix intradoc links + make encoder impl take a slice, not vec
0xcrust Sep 28, 2023
1854d82
Use internal write buffer
0xcrust Sep 28, 2023
b494926
Use `split_to`
thomaseizinger Sep 28, 2023
2c05e75
Special-case empty frame
thomaseizinger Sep 28, 2023
0da7740
Fix incompatibility issue
thomaseizinger Sep 29, 2023
2e518e0
No need to special-case empty bytes
thomaseizinger Sep 29, 2023
dbbf7ea
Remove length codec struct to allow borrowing
thomaseizinger Sep 29, 2023
5627360
Go back to reusing buffers
thomaseizinger Sep 29, 2023
3745f04
Add docs
thomaseizinger Sep 29, 2023
d50257d
Fix interoperability tests
thomaseizinger Sep 29, 2023
140032c
Bump asynchronous-codec to v0.7
0xcrust Oct 14, 2023
5edc42a
Merge branch 'master' into noise-framing
thomaseizinger Oct 26, 2023
9a13865
Update Cargo.lock
thomaseizinger Oct 26, 2023
132c05f
Merge branch 'master' into noise-framing
mergify[bot] Oct 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 26 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions transports/noise/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"

[dependencies]
asynchronous-codec = "0.7"
bytes = "1"
curve25519-dalek = "4.1.1"
futures = "0.3.28"
Expand Down
9 changes: 5 additions & 4 deletions transports/noise/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@

mod framed;
pub(crate) mod handshake;
use asynchronous_codec::Framed;
use bytes::Bytes;
use framed::{NoiseFramed, MAX_FRAME_LEN};
use framed::{Codec, MAX_FRAME_LEN};
use futures::prelude::*;
use futures::ready;
use log::trace;
Expand All @@ -38,7 +39,7 @@ use std::{
///
/// `T` is the type of the underlying I/O resource.
pub struct Output<T> {
io: NoiseFramed<T, snow::TransportState>,
io: Framed<T, Codec<snow::TransportState>>,
recv_buffer: Bytes,
recv_offset: usize,
send_buffer: Vec<u8>,
Expand All @@ -47,12 +48,12 @@ pub struct Output<T> {

impl<T> fmt::Debug for Output<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("NoiseOutput").field("io", &self.io).finish()
f.debug_struct("NoiseOutput").finish()
}
}

impl<T> Output<T> {
fn new(io: NoiseFramed<T, snow::TransportState>) -> Self {
fn new(io: Framed<T, Codec<snow::TransportState>>) -> Self {
Output {
io,
recv_buffer: Bytes::new(),
Expand Down
Loading
Loading