From 7d6c0e68a19ad5e2e4e05cfc219d446be6ff2286 Mon Sep 17 00:00:00 2001 From: hozan23 Date: Thu, 30 Nov 2023 22:52:53 +0300 Subject: jsonrpc: Enhance the API and add support for TCP, Unix, and TLS protocols. --- jsonrpc/src/client.rs | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'jsonrpc/src/client.rs') diff --git a/jsonrpc/src/client.rs b/jsonrpc/src/client.rs index 939d177..0061002 100644 --- a/jsonrpc/src/client.rs +++ b/jsonrpc/src/client.rs @@ -2,7 +2,7 @@ use log::debug; use serde::{de::DeserializeOwned, Serialize}; use karyons_core::util::random_32; -use karyons_net::{dial, Conn, Endpoint}; +use karyons_net::Conn; use crate::{ codec::{Codec, CodecConfig}, @@ -22,7 +22,7 @@ pub struct Client { } impl Client { - /// Creates a new RPC client. + /// Creates a new RPC client by passing a Tcp, Unix, or Tls connection. pub fn new(conn: Conn, config: ClientConfig) -> Self { let codec_config = CodecConfig { max_allowed_buffer_size: 0, @@ -32,17 +32,6 @@ impl Client { Self { codec, config } } - /// Creates a new RPC client using the provided endpoint. - pub async fn new_with_endpoint(endpoint: &Endpoint, config: ClientConfig) -> Result { - let conn = dial(endpoint).await?; - let codec_config = CodecConfig { - max_allowed_buffer_size: 0, - ..Default::default() - }; - let codec = Codec::new(conn, codec_config); - Ok(Self { codec, config }) - } - /// Calls the named method, waits for the response, and returns the result. pub async fn call( &self, -- cgit v1.2.3