diff --git a/Cargo.toml b/Cargo.toml index 757dbbc..073a968 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,24 +5,31 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +default = [ "rustls" ] + +rustls = [ "reqwest/rustls-tls", "tokio-tungstenite/rustls-tls-native-roots" ] +# untested! +nativetls = [ "reqwest/native-tls", "tokio-tungstenite/native-tls" ] + [dependencies] #giterated-daemon = { git = "https://giterated.dev/ambee/giterated-daemon" } giterated-models = { path = "../giterated-daemon/giterated-models" } -tokio-tungstenite = { version = "*", features = ["rustls-tls-native-roots"] } +tokio-tungstenite = { version = "0.20" } tokio = { version = "1.32.0", features = ["full"] } -tracing = "*" -futures-util = "*" +tracing = "0.1" +futures-util = "0.3" serde = { version = "1", features = ["derive"]} serde_json = "1.0" -bincode = "*" +bincode = "1.3" tracing-subscriber = "0.3" -rand = "*" -jsonwebtoken = { version = "*", features = ["use_pem"]} +rand = "0.8" +jsonwebtoken = { version = "8.3", features = ["use_pem"]} chrono = { version = "0.4", features = [ "serde", "std" ] } -reqwest = { version = "0.11" } -anyhow = "*" -deadpool = "0.9" -async-trait = "*" -thiserror = "*" -semver = "*" +reqwest = { version = "0.11", default-features = false } +anyhow = "1" +deadpool = "0.10" +async-trait = "0.1" +thiserror = "1" +semver = "1" color-eyre = "0.6.2" \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 0ac7431..73ca3e5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -29,7 +29,7 @@ impl Debug for DaemonConnectionPool { impl DaemonConnectionPool { pub fn connect( instance: impl ToOwned, - ) -> Result> { + ) -> Result { let instance = instance.to_owned(); Ok(Self( Pool::builder(GiteratedConnectionPool { @@ -43,7 +43,7 @@ impl DaemonConnectionPool { pub fn connect_other( instance_identity: impl ToOwned, connection_addr: SocketAddr, - ) -> Result> { + ) -> Result { Ok(Self( Pool::builder(GiteratedConnectionPool { target_instance: instance_identity.to_owned(), diff --git a/src/pool.rs b/src/pool.rs index 1c6787a..2306e9c 100644 --- a/src/pool.rs +++ b/src/pool.rs @@ -1,6 +1,6 @@ use std::net::SocketAddr; -use deadpool::managed::{Manager, RecycleError, RecycleResult}; +use deadpool::managed::{Manager, RecycleError, RecycleResult, Metrics}; use futures_util::SinkExt; use giterated_models::instance::Instance; use tokio_tungstenite::{connect_async, tungstenite::Message}; @@ -28,7 +28,7 @@ impl Manager for GiteratedConnectionPool { Ok(connection) } - async fn recycle(&self, socket: &mut Socket) -> RecycleResult { + async fn recycle(&self, socket: &mut Socket, _metrics: &Metrics) -> RecycleResult { match socket.send(Message::Ping(vec![])).await { Ok(_) => Ok(()), Err(err) => {