ptmgr: Mark PtMessage and next_message as experimental-api.
These are implementation details and we don't want to mark them as stable. To do this, I needed to apply some additional options to the example code's configuration in Cargo.toml.
This commit is contained in:
parent
d6642ef6ac
commit
8d0ac9bdc8
|
@ -4085,6 +4085,7 @@ dependencies = [
|
||||||
"tor-socksproto",
|
"tor-socksproto",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
|
"visibility",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -15,6 +15,9 @@ repository = "https://gitlab.torproject.org/tpo/core/arti.git/"
|
||||||
default = ["tor-channel-factory"]
|
default = ["tor-channel-factory"]
|
||||||
tor-channel-factory = []
|
tor-channel-factory = []
|
||||||
|
|
||||||
|
experimental = ["experimental-api"]
|
||||||
|
experimental-api = ["visibility"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = "0.1.2"
|
async-trait = "0.1.2"
|
||||||
derive_builder = { version = "0.11.2", package = "derive_builder_fork_arti" }
|
derive_builder = { version = "0.11.2", package = "derive_builder_fork_arti" }
|
||||||
|
@ -29,6 +32,7 @@ tor-linkspec = { version = "0.5.1", path = "../tor-linkspec", features = ["pt-cl
|
||||||
tor-rtcompat = { version = "0.7.0", path = "../tor-rtcompat" }
|
tor-rtcompat = { version = "0.7.0", path = "../tor-rtcompat" }
|
||||||
tor-socksproto = { version = "0.5.1", path = "../tor-socksproto" }
|
tor-socksproto = { version = "0.5.1", path = "../tor-socksproto" }
|
||||||
tracing = "0.1.18"
|
tracing = "0.1.18"
|
||||||
|
visibility = { version = "0.0.1", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
anyhow = "1.0.23"
|
anyhow = "1.0.23"
|
||||||
|
@ -42,3 +46,7 @@ tokio = { version = "1.7", features = [
|
||||||
] }
|
] }
|
||||||
tor-rtcompat = { path = "../tor-rtcompat", version = "0.7.0", features = ["tokio", "native-tls"] }
|
tor-rtcompat = { path = "../tor-rtcompat", version = "0.7.0", features = ["tokio", "native-tls"] }
|
||||||
tracing-subscriber = "0.3.0"
|
tracing-subscriber = "0.3.0"
|
||||||
|
|
||||||
|
[[example]]
|
||||||
|
name = "run-pt"
|
||||||
|
required-features = ["experimental-api"]
|
||||||
|
|
|
@ -35,4 +35,18 @@ TODO pt-client: The first version of this crate will probably only conform
|
||||||
to the old Tor pluggable transport protocol, and not to more recent variants
|
to the old Tor pluggable transport protocol, and not to more recent variants
|
||||||
as documented at `pluggabletransports.info`
|
as documented at `pluggabletransports.info`
|
||||||
|
|
||||||
|
## Feature flags
|
||||||
|
|
||||||
|
### Experimental and unstable features
|
||||||
|
|
||||||
|
Note that the APIs enabled by these features are NOT covered by semantic
|
||||||
|
versioning guarantees: we might break them or remove them between patch
|
||||||
|
versions.
|
||||||
|
|
||||||
|
* `experimental-api` -- build with experimental, unstable API support.
|
||||||
|
|
||||||
|
* `experimental` -- Build with all experimental features above, along with
|
||||||
|
all experimental features from other arti crates.
|
||||||
|
|
||||||
|
|
||||||
License: MIT OR Apache-2.0
|
License: MIT OR Apache-2.0
|
||||||
|
|
|
@ -47,10 +47,10 @@ pub struct PtStatus {
|
||||||
/// A message sent from a pluggable transport child process.
|
/// A message sent from a pluggable transport child process.
|
||||||
///
|
///
|
||||||
/// For more in-depth information about these messages, consult pt-spec.txt.
|
/// For more in-depth information about these messages, consult pt-spec.txt.
|
||||||
// TODO pt-client: this shouldn't be `pub`
|
|
||||||
#[derive(PartialEq, Eq, Debug, Clone)]
|
#[derive(PartialEq, Eq, Debug, Clone)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub enum PtMessage {
|
#[cfg_attr(feature = "experimental-api", visibility::make(pub))]
|
||||||
|
pub(crate) enum PtMessage {
|
||||||
/// `VERSION-ERROR`: No compatible pluggable transport specification version was provided.
|
/// `VERSION-ERROR`: No compatible pluggable transport specification version was provided.
|
||||||
VersionError(String),
|
VersionError(String),
|
||||||
/// `VERSION`: Specifies the version the binary is using for the IPC protocol.
|
/// `VERSION`: Specifies the version the binary is using for the IPC protocol.
|
||||||
|
@ -600,7 +600,8 @@ impl PluggableTransport {
|
||||||
// FIXME(eta): This API will probably go away and get replaced with something better.
|
// FIXME(eta): This API will probably go away and get replaced with something better.
|
||||||
// In particular, we'd want to cache `Status` messages from before this method
|
// In particular, we'd want to cache `Status` messages from before this method
|
||||||
// was called.
|
// was called.
|
||||||
pub async fn next_message(&mut self) -> err::Result<PtMessage> {
|
#[cfg_attr(feature = "experimental-api", visibility::make(pub))]
|
||||||
|
pub(crate) async fn next_message(&mut self) -> err::Result<PtMessage> {
|
||||||
let inner = self.inner.as_mut().ok_or(PtError::ChildGone)?;
|
let inner = self.inner.as_mut().ok_or(PtError::ChildGone)?;
|
||||||
let ret = inner.recv().await;
|
let ret = inner.recv().await;
|
||||||
if let Err(PtError::ChildGone) | Err(PtError::ChildReadFailed { .. }) = ret {
|
if let Err(PtError::ChildGone) | Err(PtError::ChildReadFailed { .. }) = ret {
|
||||||
|
|
Loading…
Reference in New Issue