#![cfg_attr(not(unix), allow(unused_imports))] use fundamentum_edge_proto::com::fundamentum::edge::v1::configuration_client::ConfigurationClient; use tokio::net::UnixStream; use tonic::{transport::Endpoint, Request}; use tower::service_fn; #[cfg(unix)] #[tokio::main] async fn main() -> Result<(), Box> { let channel = Endpoint::try_from("http://127.0.0.1:8080")? .connect_with_connector(service_fn(|_| UnixStream::connect("/tmp/socket"))) .await?; let mut client = ConfigurationClient::new(channel); let response = client.get(Request::new(())).await?; println!("Get Config Response = {:?}", response.into_inner()); Ok(()) } #[cfg(not(unix))] async fn main() -> Result<(), Box> { panic!("The `uds` example only works on unix systems!"); }