1use anyhow::Error;
2use std::result::Result::Ok;
3use tonic::{transport::Channel};
4use tonic_reflection::pb::v1::{
5 server_reflection_client::ServerReflectionClient,
6};
7use crate::agent::agent_client::AgentClient;
8
9const AGENT_IP : &str = "http://127.0.0.1:9090";
10
11pub async fn connect_to_client() -> Result<AgentClient<Channel>, Error> {
12 let channel = Channel::from_static(AGENT_IP)
15 .connect()
16 .await?;
17 let client = AgentClient::new(channel);
18 Ok(client)
19}
20
21pub async fn connect_to_server_reflection() -> Result<ServerReflectionClient<Channel>, Error> {
22 let channel = Channel::from_static(AGENT_IP)
24 .connect()
25 .await?;
26 let client = ServerReflectionClient::new(channel);
27 Ok(client)
28}