difftreelog
refactor drop NixDaemon::connect_daemon
in: trunk
4 files changed
Cargo.lockdiffbeforeafterboth308308309[[package]]309[[package]]310name = "bifrostlink"310name = "bifrostlink"311version = "0.2.5"311version = "0.2.6"312source = "registry+https://github.com/rust-lang/crates.io-index"312source = "registry+https://github.com/rust-lang/crates.io-index"313checksum = "910f9286588d13e3dbdbbc1ad4d292656e704bc93e1f41b8a13b48e3a8e95f39"313checksum = "2fb01af731c11dd31b23783a83a36a29f644cc1972481f6fa4f4fabc709079eb"314dependencies = [314dependencies = [315 "async-trait",315 "async-trait",316 "async_fn_traits",316 "async_fn_traits",327327328[[package]]328[[package]]329name = "bifrostlink-macros"329name = "bifrostlink-macros"330version = "0.2.5"330version = "0.2.6"331source = "registry+https://github.com/rust-lang/crates.io-index"331source = "registry+https://github.com/rust-lang/crates.io-index"332checksum = "a0ea5c423c3831c523c8ef78debdf6a64e72b21ec92148a44163a4c25c05dfd0"332checksum = "8c4b7a5fb38b36bd81910c17ebf369f9296e508d92b1277a768a63c8a2254fdb"333dependencies = [333dependencies = [334 "proc-macro2",334 "proc-macro2",335 "quote",335 "quote",338338339[[package]]339[[package]]340name = "bifrostlink-ports"340name = "bifrostlink-ports"341version = "0.2.5"341version = "0.2.6"342source = "registry+https://github.com/rust-lang/crates.io-index"342source = "registry+https://github.com/rust-lang/crates.io-index"343checksum = "9e3a9a01ec1b8bd7d44b47cd0183a1465880e241027d9f5afcb076e11704ec70"343checksum = "977acfcb8ed3c24ab7c2f76fb3eeebff1533c72708733ce6020f2501980b7cf2"344dependencies = [344dependencies = [345 "bifrostlink",345 "bifrostlink",346 "bytes",346 "bytes",183518351836[[package]]1836[[package]]1837name = "polkit-backend"1837name = "polkit-backend"1838version = "0.1.6"1838version = "0.1.7"1839dependencies = [1839dependencies = [1840 "anyhow",1840 "anyhow",1841 "clap",1841 "clap",205520552056[[package]]2056[[package]]2057name = "remowt-agent"2057name = "remowt-agent"2058version = "0.1.6"2058version = "0.1.7"2059dependencies = [2059dependencies = [2060 "anyhow",2060 "anyhow",2061 "bifrostlink",2061 "bifrostlink",208320832084[[package]]2084[[package]]2085name = "remowt-client"2085name = "remowt-client"2086version = "0.1.6"2086version = "0.1.7"2087dependencies = [2087dependencies = [2088 "anyhow",2088 "anyhow",2089 "bifrostlink",2089 "bifrostlink",210621062107[[package]]2107[[package]]2108name = "remowt-endpoints"2108name = "remowt-endpoints"2109version = "0.1.6"2109version = "0.1.7"2110dependencies = [2110dependencies = [2111 "anyhow",2111 "anyhow",2112 "bifrostlink",2112 "bifrostlink",212421242125[[package]]2125[[package]]2126name = "remowt-link-shared"2126name = "remowt-link-shared"2127version = "0.1.6"2127version = "0.1.7"2128dependencies = [2128dependencies = [2129 "bifrostlink",2129 "bifrostlink",2130 "bytes",2130 "bytes",213821382139[[package]]2139[[package]]2140name = "remowt-plugin"2140name = "remowt-plugin"2141version = "0.1.6"2141version = "0.1.7"2142dependencies = [2142dependencies = [2143 "anyhow",2143 "anyhow",2144 "bifrostlink",2144 "bifrostlink",215221522153[[package]]2153[[package]]2154name = "remowt-polkit-shared"2154name = "remowt-polkit-shared"2155version = "0.1.6"2155version = "0.1.7"2156dependencies = [2156dependencies = [2157 "nix",2157 "nix",2158 "serde",2158 "serde",216121612162[[package]]2162[[package]]2163name = "remowt-ssh"2163name = "remowt-ssh"2164version = "0.1.6"2164version = "0.1.7"2165dependencies = [2165dependencies = [2166 "anyhow",2166 "anyhow",2167 "async-trait",2167 "async-trait",218921892190[[package]]2190[[package]]2191name = "remowt-ui-prompt"2191name = "remowt-ui-prompt"2192version = "0.1.6"2192version = "0.1.7"2193dependencies = [2193dependencies = [2194 "anyhow",2194 "anyhow",2195 "bifrostlink",2195 "bifrostlink",Cargo.tomldiffbeforeafterboth3resolver = "2"3resolver = "2"445[workspace.package]5[workspace.package]6version = "0.1.6"6version = "0.1.7"7license = "MIT"7license = "MIT"8edition = "2021"8edition = "2021"9repository = "https://git.delta.rocks/r/remowt"9repository = "https://git.delta.rocks/r/remowt"101011[workspace.dependencies]11[workspace.dependencies]12remowt-client = { version = "0.1.6", path = "crates/remowt-client" }12remowt-client = { version = "0.1.7", path = "crates/remowt-client" }13remowt-polkit-shared = { version = "0.1.6", path = "crates/polkit-shared" }13remowt-polkit-shared = { version = "0.1.7", path = "crates/polkit-shared" }14remowt-link-shared = { version = "0.1.6", path = "crates/remowt-link-shared" }14remowt-link-shared = { version = "0.1.7", path = "crates/remowt-link-shared" }15remowt-plugin = { version = "0.1.6", path = "crates/remowt-plugin" }15remowt-plugin = { version = "0.1.7", path = "crates/remowt-plugin" }16remowt-ui-prompt = { version = "0.1.6", path = "crates/remowt-ui-prompt" }16remowt-ui-prompt = { version = "0.1.7", path = "crates/remowt-ui-prompt" }17remowt-endpoints = { version = "0.1.6", path = "crates/remowt-endpoints" }17remowt-endpoints = { version = "0.1.7", path = "crates/remowt-endpoints" }181819bifrostlink = "0.2.0"19bifrostlink = "0.2.0"20bifrostlink-macros = "0.2.0"20bifrostlink-macros = "0.2.0"crates/remowt-client/src/lib.rsdiffbeforeafterboth427 };427 };428428429 let (tool, flags) = self.detect_escalation().await?;429 let (tool, flags) = self.detect_escalation().await?;430 let mut args: Vec<String> = flags.iter().map(|f| (*f).to_owned()).collect();430 let mut args: Vec<String> = Vec::new();431 args.push("-w".to_owned());432 args.push(tool.to_owned());433 args.extend(flags.iter().copied().map(str::to_owned));431 args.push(agent_path);434 args.push(agent_path);432 args.push("real-agent".to_owned());435 args.push("real-agent".to_owned());433 args.push("--privileged".to_owned());436 args.push("--privileged".to_owned());437440438 let child = self441 let child = self439 .spawn(SpawnOptions {442 .spawn(SpawnOptions {440 program: tool.to_owned(),443 program: "setsid".to_owned(),441 args,444 args,442 stdin: StdioMode::Pipe,445 stdin: StdioMode::Pipe,443 stdout: StdioMode::Pipe,446 stdout: StdioMode::Pipe,crates/remowt-endpoints/src/nix_daemon.rsdiffbeforeafterboth6use std::result::Result;6use std::result::Result;7use tokio::process::Command;7use tokio::process::Command;89pub const NIX_DAEMON_SOCKET: &str = "/nix/var/nix/daemon-socket/socket";10811pub struct NixDaemon;9pub struct NixDaemon;1210201821#[endpoints(ns = 4)]19#[endpoints(ns = 4)]22impl NixDaemon {20impl NixDaemon {23 #[endpoints(id = 1)]24 async fn connect_daemon(&self, socket: String) -> Result<(), Error> {25 let mut daemon = tokio::net::UnixStream::connect(NIX_DAEMON_SOCKET)26 .await27 .map_err(|e| Error::DaemonUnavailable(e.to_string()))?;28 let mut tunnel = tokio::net::UnixStream::connect(&socket)29 .await30 .map_err(|e| Error::Tunnel(e.to_string()))?;31 tokio::spawn(async move {32 if let Err(e) = tokio::io::copy_bidirectional(&mut daemon, &mut tunnel).await {33 tracing::debug!("nix daemon tunnel ended: {e}");34 }35 });36 Ok(())37 }3839 #[endpoints(id = 2)]21 #[endpoints(id = 2)]40 async fn serve_store(&self, store: String, socket: String) -> Result<(), Error> {22 async fn serve_store(&self, store: String, socket: String) -> Result<(), Error> {