feat(core): make the upgrade module an implementation detail

Resolves: #3748.

Pull-Request: #3915.
This commit is contained in:
Thomas Eizinger 2023-05-15 15:24:18 +02:00 committed by GitHub
parent 5c785b92e7
commit 08f0b5e9c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -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

View File

@ -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,

View File

@ -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,
@ -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>>,
@ -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>>,