Chore: expose RPC modules, update dependency (#35)

* feat: expose rpc clients

* chore: expose rpc types

* chore: update dependency
This commit is contained in:
MiniFrenchBread 2024-04-02 21:00:26 +08:00 committed by GitHub
parent 588bf39d7d
commit 8b410f2fc8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 1380 additions and 1008 deletions

2377
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -37,7 +37,7 @@ tokio = { version = "1.19.2", features = ["time", "macros"] }
tokio-io-timeout = "1.2.0" tokio-io-timeout = "1.2.0"
tokio-util = { version = "0.6.10", features = ["codec", "compat", "time"] } tokio-util = { version = "0.6.10", features = ["codec", "compat", "time"] }
tracing = "0.1.35" tracing = "0.1.35"
unsigned-varint = { version = "0.7.1", features = ["codec"] } unsigned-varint = { version = "=0.7.1", features = ["codec"] }
if-addrs = "0.10.1" if-addrs = "0.10.1"
slog = "2.7.0" slog = "2.7.0"
igd = "0.12.1" igd = "0.12.1"

View File

@ -23,6 +23,7 @@ lazy_static::lazy_static! {
pub static ref TOLERABLE_DRIFT: chrono::Duration = chrono::Duration::seconds(5); pub static ref TOLERABLE_DRIFT: chrono::Duration = chrono::Duration::seconds(5);
} }
#[allow(deprecated)]
fn duration_since(timestamp: u32) -> chrono::Duration { fn duration_since(timestamp: u32) -> chrono::Duration {
let timestamp = i64::from(timestamp); let timestamp = i64::from(timestamp);
let timestamp = chrono::NaiveDateTime::from_timestamp_opt(timestamp, 0).expect("should fit"); let timestamp = chrono::NaiveDateTime::from_timestamp_opt(timestamp, 0).expect("should fit");

View File

@ -1,5 +1,6 @@
mod api; mod api;
mod r#impl; mod r#impl;
pub use api::RpcClient;
pub use api::RpcServer; pub use api::RpcServer;
pub use r#impl::RpcServerImpl; pub use r#impl::RpcServerImpl;

View File

@ -7,7 +7,7 @@ mod admin;
mod config; mod config;
mod error; mod error;
mod miner; mod miner;
mod types; pub mod types;
mod zgs; mod zgs;
use crate::miner::RpcServer as MinerRpcServer; use crate::miner::RpcServer as MinerRpcServer;
@ -29,7 +29,10 @@ use tokio::sync::mpsc::UnboundedSender;
use zgs::RpcServer as ZgsRpcServer; use zgs::RpcServer as ZgsRpcServer;
use zgs_miner::MinerMessage; use zgs_miner::MinerMessage;
pub use admin::RpcClient as ZgsAdminRpcClient;
pub use config::Config as RPCConfig; pub use config::Config as RPCConfig;
pub use miner::RpcClient as ZgsMinerRpcClient;
pub use zgs::RpcClient as ZgsRPCClient;
/// A wrapper around all the items required to spawn the HTTP server. /// A wrapper around all the items required to spawn the HTTP server.
/// ///

View File

@ -2,5 +2,6 @@
mod api; mod api;
mod r#impl; mod r#impl;
pub use api::RpcClient;
pub use api::RpcServer; pub use api::RpcServer;
pub use r#impl::RpcServerImpl; pub use r#impl::RpcServerImpl;

View File

@ -1,5 +1,6 @@
mod api; mod api;
mod r#impl; mod r#impl;
pub use api::RpcClient;
pub use api::RpcServer; pub use api::RpcServer;
pub use r#impl::RpcServerImpl; pub use r#impl::RpcServerImpl;