Integrate tunnel status streaming

This commit is contained in:
dav 2024-07-13 16:54:57 -07:00 committed by David Zhong
parent 90468d5518
commit 12f595011a
5 changed files with 85 additions and 32 deletions

17
burrow-gtk/src/daemon.rs Normal file
View file

@ -0,0 +1,17 @@
use anyhow::Result;
use hyper_util::rt::TokioIo;
use tokio::net::UnixStream;
use tonic::transport::{Channel, Endpoint, Uri};
use tower::service_fn;
const BURROW_RPC_SOCKET_PATH: &str = "/run/burrow.sock";
pub async fn daemon_connect() -> Result<Channel> {
Ok(Endpoint::try_from("http://[::]:50051")?
.connect_with_connector(service_fn(|_: Uri| async {
Ok::<_, std::io::Error>(TokioIo::new(
UnixStream::connect(BURROW_RPC_SOCKET_PATH).await?,
))
}))
.await?)
}