Integrate tunnel status streaming
This commit is contained in:
parent
90468d5518
commit
12f595011a
5 changed files with 85 additions and 32 deletions
17
burrow-gtk/src/daemon.rs
Normal file
17
burrow-gtk/src/daemon.rs
Normal 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?)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue