Skip to content

Commit

Permalink
Undo a bad merge and update changelog for silent roll out
Browse files Browse the repository at this point in the history
  • Loading branch information
umgefahren committed Aug 5, 2024
1 parent 531e8df commit 921f5f1
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

1 change: 0 additions & 1 deletion examples/autonat/src/bin/autonat_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
// DEALINGS IN THE SOFTWARE.

#![doc = include_str!("../../README.md")]
#![allow(deprecated)]

use clap::Parser;
use futures::StreamExt;
Expand Down
1 change: 0 additions & 1 deletion examples/autonat/src/bin/autonat_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
// DEALINGS IN THE SOFTWARE.

#![doc = include_str!("../../README.md")]
#![allow(deprecated)]

use clap::Parser;
use futures::StreamExt;
Expand Down
6 changes: 2 additions & 4 deletions misc/server/src/behaviour.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(deprecated)]

use libp2p::autonat;
use libp2p::identify;
use libp2p::kad;
Expand All @@ -26,7 +24,7 @@ pub(crate) struct Behaviour {
ping: ping::Behaviour,
identify: identify::Behaviour,
pub(crate) kademlia: Toggle<kad::Behaviour<kad::store::MemoryStore>>,
autonat: Toggle<autonat::v1::Behaviour>,
autonat: Toggle<autonat::Behaviour>,
}

impl Behaviour {
Expand Down Expand Up @@ -59,7 +57,7 @@ impl Behaviour {
.into();

let autonat = if enable_autonat {
Some(autonat::v1::Behaviour::new(
Some(autonat::Behaviour::new(
PeerId::from(pub_key.clone()),
Default::default(),
))
Expand Down
13 changes: 4 additions & 9 deletions protocols/autonat/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
## 0.14.0-alpha
## 0.13.0

- Due to the refactor of `Transport` it's no longer required to create a seperate transport for
AutoNAT where port reuse is disabled. This information is now passed by the behaviour.
See [PR 4568](https://github.com/libp2p/rust-libp2p/pull/4568).
- Introduce the new AutoNATv2 protocol.
It's split into a client and a server part, represented in their respective modules
Features:
- Since the server now always dials back over a newly allocated port, this made refactor(*): Transport redesign #4568 necessary; the client can be sure of the reachability state for other peers, even if the connection to the server was made through a hole punch.
- The server can now test addresses different from the observed address (i.e., the connection to the server was made through a `p2p-circuit`). To mitigate against DDoS attacks, the client has to send more data to the server than the dial-back costs.
See [PR 5526].
- Deprecate the now unnecessary first version of AutoNAT. See [PR 5526].

[PR 5526]: https://github.com/libp2p/rust-libp2p/pull/5526

## 0.13.0

- Due to the refactor of `Transport` it's no longer required to create a seperate transport for
AutoNAT where port reuse is disabled. This information is now passed by the behaviour.
See [PR 4568](https://github.com/libp2p/rust-libp2p/pull/4568).

<!-- Update to libp2p-swarm v0.45.0 -->

## 0.12.1
Expand Down
6 changes: 3 additions & 3 deletions protocols/autonat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ categories = ["network-programming", "asynchronous"]


[dependencies]
async-trait = "0.1"
async-trait = { version = "0.1", optional = true }
asynchronous-codec = { workspace = true }
bytes = { version = "1", optional = true }
either = { version = "1.9.0", optional = true }
futures = { workspace = true }
futures-bounded = { workspace = true, optional = true }
futures-timer = "3.0"
instant = "0.1"
web-time = { workspace = true, optional = true }
libp2p-core = { workspace = true }
libp2p-identity = { workspace = true }
libp2p-request-response = { workspace = true, optional = true }
Expand All @@ -42,7 +42,7 @@ libp2p-swarm = { workspace = true, features = ["macros"]}

[features]
default = ["v1", "v2"]
v1 = ["dep:libp2p-request-response"]
v1 = ["dep:libp2p-request-response", "dep:web-time", "dep:async-trait"]
v2 = ["dep:bytes", "dep:either", "dep:futures-bounded", "dep:thiserror", "dep:void", "dep:rand_core"]

[lints]
Expand Down
1 change: 0 additions & 1 deletion protocols/autonat/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ pub mod v1;
pub mod v2;

#[cfg(feature = "v1")]
#[allow(deprecated)]
pub use v1::*;
5 changes: 4 additions & 1 deletion protocols/autonat/src/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@
// DEALINGS IN THE SOFTWARE.

//! Implementation of the [AutoNAT](https://github.com/libp2p/specs/blob/master/autonat/README.md) protocol.
//!
//! ## Eventual Deprecation
//! This version of the protocol will eventually be deprecated in favor of [v2](crate::v2).
//! We recommend using v2 for new projects.
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![cfg_attr(not(test), deprecated(note = "Please use `v2` module instead."))]

pub(crate) mod behaviour;
pub(crate) mod protocol;
Expand Down
2 changes: 1 addition & 1 deletion protocols/autonat/src/v1/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ pub use as_client::{OutboundProbeError, OutboundProbeEvent};
use as_server::AsServer;
pub use as_server::{InboundProbeError, InboundProbeEvent};
use futures_timer::Delay;
use instant::Instant;
use libp2p_core::transport::PortUse;
use libp2p_core::{multiaddr::Protocol, ConnectedPoint, Endpoint, Multiaddr};
use libp2p_identity::PeerId;
Expand All @@ -46,6 +45,7 @@ use std::{
task::{Context, Poll},
time::Duration,
};
use web_time::Instant;

/// Config for the [`Behaviour`].
#[derive(Debug, Clone, PartialEq, Eq)]
Expand Down
2 changes: 1 addition & 1 deletion protocols/autonat/src/v1/behaviour/as_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use super::{
};
use futures::FutureExt;
use futures_timer::Delay;
use instant::Instant;
use libp2p_core::Multiaddr;
use libp2p_identity::PeerId;
use libp2p_request_response::{self as request_response, OutboundFailure, OutboundRequestId};
Expand All @@ -37,6 +36,7 @@ use std::{
task::{Context, Poll},
time::Duration,
};
use web_time::Instant;

/// Outbound probe failed or was aborted.
#[derive(Debug)]
Expand Down
2 changes: 1 addition & 1 deletion protocols/autonat/src/v1/behaviour/as_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use super::{
Action, AutoNatCodec, Config, DialRequest, DialResponse, Event, HandleInnerEvent, ProbeId,
ResponseError,
};
use instant::Instant;
use libp2p_core::{multiaddr::Protocol, Multiaddr};
use libp2p_identity::PeerId;
use libp2p_request_response::{
Expand All @@ -35,6 +34,7 @@ use std::{
collections::{HashMap, HashSet, VecDeque},
num::NonZeroU8,
};
use web_time::Instant;

/// Inbound probe failed.
#[derive(Debug)]
Expand Down
1 change: 0 additions & 1 deletion protocols/autonat/tests/test_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#![allow(deprecated)]

use async_std::task::JoinHandle;
use libp2p_autonat::{
Expand Down
1 change: 0 additions & 1 deletion protocols/autonat/tests/test_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#![allow(deprecated)]

use libp2p_autonat::{
Behaviour, Config, Event, InboundProbeError, InboundProbeEvent, ResponseError,
Expand Down

0 comments on commit 921f5f1

Please sign in to comment.