Skip to content

Commit

Permalink
feat(core): make the upgrade module an implementation detail
Browse files Browse the repository at this point in the history
Resolves: #3748.

Pull-Request: #3915.
  • Loading branch information
thomaseizinger authored May 15, 2023
1 parent 5c785b9 commit 08f0b5e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@
- Add `global_only::Transport` that refuses to dial IP addresses from private ranges.
See [PR 3814].

- Remove `upgrade::{apply, apply_inbound, apply_outbound, InboundUpgradeApply, OutboundUpgradeApply}` from public API.
These are implementation details that should not be depended on.
See [PR 3915].

[spec]: https://github.com/libp2p/specs/blob/master/connections/README.md#multistream-select
[PR 3746]: https://github.com/libp2p/rust-libp2p/pull/3746
[PR 3883]: https://github.com/libp2p/rust-libp2p/pull/3883
[PR 3814]: https://github.com/libp2p/rust-libp2p/pull/3814
[PR 3915]: https://github.com/libp2p/rust-libp2p/pull/3915

## 0.39.2

Expand Down
4 changes: 3 additions & 1 deletion core/src/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ mod ready;
mod select;
mod transfer;

pub(crate) use apply::{
apply, apply_inbound, apply_outbound, InboundUpgradeApply, OutboundUpgradeApply,
};
use futures::future::Future;

pub use self::{
apply::{apply, apply_inbound, apply_outbound, InboundUpgradeApply, OutboundUpgradeApply},
denied::DeniedUpgrade,
error::UpgradeError,
pending::PendingUpgrade,
Expand Down
6 changes: 3 additions & 3 deletions core/src/upgrade/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub(crate) use multistream_select::Version;

// TODO: Still needed?
/// Applies an upgrade to the inbound and outbound direction of a connection or substream.
pub fn apply<C, U>(
pub(crate) fn apply<C, U>(
conn: C,
up: U,
cp: ConnectedPoint,
Expand All @@ -48,7 +48,7 @@ where
}

/// Tries to perform an upgrade on an inbound connection or substream.
pub fn apply_inbound<C, U>(conn: C, up: U) -> InboundUpgradeApply<C, U>
pub(crate) fn apply_inbound<C, U>(conn: C, up: U) -> InboundUpgradeApply<C, U>
where
C: AsyncRead + AsyncWrite + Unpin,
U: InboundUpgrade<Negotiated<C>>,
Expand All @@ -62,7 +62,7 @@ where
}

/// Tries to perform an upgrade on an outbound connection or substream.
pub fn apply_outbound<C, U>(conn: C, up: U, v: Version) -> OutboundUpgradeApply<C, U>
pub(crate) fn apply_outbound<C, U>(conn: C, up: U, v: Version) -> OutboundUpgradeApply<C, U>
where
C: AsyncRead + AsyncWrite + Unpin,
U: OutboundUpgrade<Negotiated<C>>,
Expand Down

0 comments on commit 08f0b5e

Please sign in to comment.