Skip to content

Commit

Permalink
chore(deps): Extract hyper-named-pipe to crate
Browse files Browse the repository at this point in the history
  • Loading branch information
fussybeaver committed Jan 20, 2024
1 parent 889025a commit 436f394
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 162 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ futures-util = "0.3"
hex = "0.4.2"
home = { version = "0.5", optional = true }
http = "1.0"
http-body-util = "0.1.0"
hyper = { version = "1", features = ["client", "http1"] }
hyper-rustls = { version = "0.26", optional = true }
hyper-util = { version = "0.1.2", features = ["http1", "client-legacy", "tokio"] }
http-body-util = "0.1.0"
log = "0.4"
pin-project-lite = "0.2.8"
num = { version = "0.4", optional = true }
Expand Down Expand Up @@ -86,6 +86,7 @@ hyperlocal = { git = "https://github.com/iamjpotts/hyperlocal", branch = "202401
termion = "2.0"

[target.'cfg(windows)'.dependencies]
hyper-named-pipe = { version = "0.1.0-rc1" }
winapi = { version = "0.3.9", features = ["winerror"] }
tower-service = { version = "0.3" }

Expand Down
4 changes: 2 additions & 2 deletions src/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ use tokio_util::codec::FramedRead;
use crate::container::LogOutput;
use crate::errors::Error;
use crate::errors::Error::*;
#[cfg(windows)]
use crate::named_pipe::NamedPipeConnector;
use crate::read::{
AsyncUpgraded, IncomingStream, JsonLineDecoder, NewlineLogOutputDecoder, StreamReader,
};
use crate::uri::Uri;
#[cfg(windows)]
use hyper_named_pipe::NamedPipeConnector;

use serde::de::DeserializeOwned;
use serde::ser::Serialize;
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ mod docker;
pub mod errors;
pub mod exec;
pub mod image;
mod named_pipe;
pub mod network;
mod read;
pub mod secret;
Expand Down
132 changes: 0 additions & 132 deletions src/named_pipe.rs

This file was deleted.

26 changes: 0 additions & 26 deletions src/uri.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#[cfg(windows)]
use hex::FromHex;
use hyper::Uri as HyperUri;
use log::trace;
use url::Url;
Expand Down Expand Up @@ -89,28 +87,4 @@ impl<'a> Uri<'a> {
ClientType::NamedPipe => "net.pipe",
}
}

#[cfg(windows)]
fn socket_path(uri: &HyperUri) -> Option<String> {
uri.host()
.iter()
.filter_map(|host| {
Vec::from_hex(host)
.ok()
.map(|raw| String::from_utf8_lossy(&raw).into_owned())
})
.next()
}

#[cfg(windows)]
pub(crate) fn socket_path_dest(dest: &HyperUri, client_type: &ClientType) -> Option<String> {
format!(
"{}://{}",
Uri::socket_scheme(client_type),
dest.host().unwrap_or("UNKNOWN_HOST")
)
.parse()
.ok()
.and_then(|uri| Self::socket_path(&uri))
}
}

0 comments on commit 436f394

Please sign in to comment.