JavaScript is disabled, refresh for a better experience. ambee/giterated-api

ambee/giterated-api

Git repository hosting, collaboration, and discovery for the Fediverse.

Optional nativetls, defined versions and update deadpool.

erremilia - ⁨2⁩ years ago

parent: tbd commit: ⁨6a2b9bb

Showing ⁨⁨3⁩ changed files⁩ with ⁨⁨23⁩ insertions⁩ and ⁨⁨16⁩ deletions⁩

Cargo.toml

View file
@@ -5,24 +5,31 @@ edition = "2021"
5 5
6 6 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7 7
8 [features]
9 default = [ "rustls" ]
10
11 rustls = [ "reqwest/rustls-tls", "tokio-tungstenite/rustls-tls-native-roots" ]
12 # untested!
13 nativetls = [ "reqwest/native-tls", "tokio-tungstenite/native-tls" ]
14
8 15 [dependencies]
9 16 #giterated-daemon = { git = "https://giterated.dev/ambee/giterated-daemon" }
10 17 giterated-models = { path = "../giterated-daemon/giterated-models" }
11 tokio-tungstenite = { version = "*", features = ["rustls-tls-native-roots"] }
18 tokio-tungstenite = { version = "0.20" }
12 19 tokio = { version = "1.32.0", features = ["full"] }
13 tracing = "*"
14 futures-util = "*"
20 tracing = "0.1"
21 futures-util = "0.3"
15 22 serde = { version = "1", features = ["derive"]}
16 23 serde_json = "1.0"
17 bincode = "*"
24 bincode = "1.3"
18 25 tracing-subscriber = "0.3"
19 rand = "*"
20 jsonwebtoken = { version = "*", features = ["use_pem"]}
26 rand = "0.8"
27 jsonwebtoken = { version = "8.3", features = ["use_pem"]}
21 28 chrono = { version = "0.4", features = [ "serde", "std" ] }
22 reqwest = { version = "0.11" }
23 anyhow = "*"
24 deadpool = "0.9"
25 async-trait = "*"
26 thiserror = "*"
27 semver = "*"
29 reqwest = { version = "0.11", default-features = false }
30 anyhow = "1"
31 deadpool = "0.10"
32 async-trait = "0.1"
33 thiserror = "1"
34 semver = "1"
28 35 color-eyre = "0.6.2"
28 35 \ No newline at end of file

src/lib.rs

View file
@@ -29,7 +29,7 @@ impl Debug for DaemonConnectionPool {
29 29 impl DaemonConnectionPool {
30 30 pub fn connect(
31 31 instance: impl ToOwned<Owned = Instance>,
32 ) -> Result<Self, BuildError<anyhow::Error>> {
32 ) -> Result<Self, BuildError> {
33 33 let instance = instance.to_owned();
34 34 Ok(Self(
35 35 Pool::builder(GiteratedConnectionPool {
@@ -43,7 +43,7 @@ impl DaemonConnectionPool {
43 43 pub fn connect_other(
44 44 instance_identity: impl ToOwned<Owned = Instance>,
45 45 connection_addr: SocketAddr,
46 ) -> Result<Self, BuildError<anyhow::Error>> {
46 ) -> Result<Self, BuildError> {
47 47 Ok(Self(
48 48 Pool::builder(GiteratedConnectionPool {
49 49 target_instance: instance_identity.to_owned(),

src/pool.rs

View file
@@ -1,6 +1,6 @@
1 1 use std::net::SocketAddr;
2 2
3 use deadpool::managed::{Manager, RecycleError, RecycleResult};
3 use deadpool::managed::{Manager, RecycleError, RecycleResult, Metrics};
4 4 use futures_util::SinkExt;
5 5 use giterated_models::instance::Instance;
6 6 use tokio_tungstenite::{connect_async, tungstenite::Message};
@@ -28,7 +28,7 @@ impl Manager for GiteratedConnectionPool {
28 28 Ok(connection)
29 29 }
30 30
31 async fn recycle(&self, socket: &mut Socket) -> RecycleResult<Self::Error> {
31 async fn recycle(&self, socket: &mut Socket, _metrics: &Metrics) -> RecycleResult<Self::Error> {
32 32 match socket.send(Message::Ping(vec![])).await {
33 33 Ok(_) => Ok(()),
34 34 Err(err) => {