From 0450570f7682ee2735f53619681abd6a9ccff912 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 25 Jul 2023 21:23:56 +0200 Subject: finalize for release 0.1.0 --- Cargo.lock | 165 ++++--------------------------------------------------- Cargo.toml | 4 +- flake.nix | 2 +- src/login/mod.rs | 37 ++++++++----- 4 files changed, 38 insertions(+), 170 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5da7547..c3880d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -42,6 +42,7 @@ dependencies = [ "eml-codec", "futures", "hex", + "hyper-rustls 0.24.1", "im", "imap-codec", "itertools", @@ -69,15 +70,6 @@ dependencies = [ "zstd", ] -[[package]] -name = "aho-corasick" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" -dependencies = [ - "memchr", -] - [[package]] name = "android-tzdata" version = "0.1.1" @@ -401,58 +393,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "aws-sigv4" -version = "0.55.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d2ce6f507be68e968a33485ced670111d1cbad161ddbbab1e313c03d37d8f4c" -dependencies = [ - "aws-smithy-http", - "form_urlencoded", - "hex", - "hmac 0.12.1", - "http", - "once_cell", - "percent-encoding", - "regex", - "sha2 0.10.7", - "time 0.3.23", - "tracing", -] - -[[package]] -name = "aws-smithy-http" -version = "0.55.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b3b693869133551f135e1f2c77cb0b8277d9e3e17feaf2213f735857c4f0d28" -dependencies = [ - "aws-smithy-types", - "bytes", - "bytes-utils", - "futures-core", - "http", - "http-body", - "hyper", - "once_cell", - "percent-encoding", - "pin-project-lite 0.2.10", - "pin-utils", - "tracing", -] - -[[package]] -name = "aws-smithy-types" -version = "0.55.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16a3d0bf4f324f4ef9793b86a1701d9700fbcdbd12a846da45eed104c634c6e8" -dependencies = [ - "base64-simd", - "itoa", - "num-integer", - "ryu", - "time 0.3.23", -] - [[package]] name = "backtrace" version = "0.3.68" @@ -480,16 +420,6 @@ version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" -[[package]] -name = "base64-simd" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "339abbe78e73178762e23bea9dfd08e697eb3f3301cd4be981c0f78ba5859195" -dependencies = [ - "outref", - "vsimd", -] - [[package]] name = "base64ct" version = "1.0.1" @@ -603,16 +533,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" -[[package]] -name = "bytes-utils" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e47d3a8076e283f3acd27400535992edb3ba4b5bb72f8891ad8fbe7932a7d4b9" -dependencies = [ - "bytes", - "either", -] - [[package]] name = "cc" version = "1.0.79" @@ -1214,15 +1134,6 @@ dependencies = [ "digest 0.9.0", ] -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest 0.10.7", -] - [[package]] name = "http" version = "0.2.9" @@ -1447,20 +1358,18 @@ dependencies = [ [[package]] name = "k2v-client" -version = "0.0.4" -source = "git+https://git.deuxfleurs.fr/Deuxfleurs/garage.git?branch=main#18eb73d52ea5221a76da7d2620d46ae501b99cf6" +version = "0.1.1" +source = "git+https://git.deuxfleurs.fr/Deuxfleurs/garage.git?tag=v0.8.2#000006d689d2d8075599fbe1653605566ae9d36e" dependencies = [ - "aws-sigv4", "base64 0.21.2", - "hex", "http", - "hyper", - "hyper-rustls 0.24.1", + "hyper-rustls 0.23.2", "log", - "percent-encoding", + "rusoto_core", + "rusoto_credential", + "rusoto_signature", "serde", "serde_json", - "sha2 0.10.7", "thiserror", "tokio", ] @@ -1776,12 +1685,6 @@ version = "6.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" -[[package]] -name = "outref" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4030760ffd992bef45b0ae3f10ce1aba99e33464c90d14dd7c039884963ddc7a" - [[package]] name = "overload" version = "0.1.1" @@ -2022,36 +1925,13 @@ dependencies = [ "thiserror", ] -[[package]] -name = "regex" -version = "1.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata 0.3.3", - "regex-syntax 0.7.4", -] - [[package]] name = "regex-automata" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" dependencies = [ - "regex-syntax 0.6.29", -] - -[[package]] -name = "regex-automata" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax 0.7.4", + "regex-syntax", ] [[package]] @@ -2060,12 +1940,6 @@ version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" -[[package]] -name = "regex-syntax" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" - [[package]] name = "ring" version = "0.16.20" @@ -2183,7 +2057,7 @@ dependencies = [ "digest 0.9.0", "futures", "hex", - "hmac 0.11.0", + "hmac", "http", "hyper", "log", @@ -2193,7 +2067,7 @@ dependencies = [ "rusoto_credential", "rustc_version", "serde", - "sha2 0.9.9", + "sha2", "tokio", ] @@ -2403,17 +2277,6 @@ dependencies = [ "opaque-debug", ] -[[package]] -name = "sha2" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", -] - [[package]] name = "sharded-slab" version = "0.1.4" @@ -2507,7 +2370,7 @@ dependencies = [ "lazy_static", "nom 6.1.2", "pin-project", - "regex-automata 0.1.10", + "regex-automata", "serde", ] @@ -3004,12 +2867,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "vsimd" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" - [[package]] name = "waker-fn" version = "1.1.0" diff --git a/Cargo.toml b/Cargo.toml index 14143da..2debf2e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ log = "0.4" rusoto_core = { version = "0.48.0", default_features = false, features = ["rustls"] } rusoto_credential = "0.48.0" rusoto_s3 = { version = "0.48.0", default_features = false, features = ["rustls"] } - +hyper-rustls = { version = "0.24", features = ["http2"] } rusoto_signature = "0.48.0" serde = "1.0.137" rand = "0.8.5" @@ -44,7 +44,7 @@ tower = "0.4" imap-codec = { git = "https://github.com/superboum/imap-codec.git", branch = "v0.5.x" } chrono = { version = "0.4", default-features = false, features = ["alloc"] } -k2v-client = { git = "https://git.deuxfleurs.fr/Deuxfleurs/garage.git", branch = "main" } +k2v-client = { git = "https://git.deuxfleurs.fr/Deuxfleurs/garage.git", tag = "v0.8.2" } boitalettres = { git = "https://git.deuxfleurs.fr/quentin/boitalettres.git", branch = "expose-mydatetime" } smtp-message = { git = "http://github.com/Alexis211/kannader", branch = "feature/lmtp" } smtp-server = { git = "http://github.com/Alexis211/kannader", branch = "feature/lmtp" } diff --git a/flake.nix b/flake.nix index 895303d..5d83b00 100644 --- a/flake.nix +++ b/flake.nix @@ -137,7 +137,7 @@ name = "dxflrs/aerogramme"; architecture = (builtins.getAttr targetHost archMap).GOARCH; config = { - Cmd = [ "${bin}" ]; + Cmd = [ "${bin}" "server" ]; }; }; diff --git a/src/login/mod.rs b/src/login/mod.rs index a68cd9c..a204db4 100644 --- a/src/login/mod.rs +++ b/src/login/mod.rs @@ -7,11 +7,11 @@ use std::sync::Arc; use anyhow::{anyhow, bail, Context, Result}; use async_trait::async_trait; use k2v_client::{ - BatchInsertOp, BatchReadOp, CausalValue, CausalityToken, Filter, K2vClient, K2vValue, K2vClientConfig + BatchInsertOp, BatchReadOp, CausalValue, CausalityToken, Filter, K2vClient, K2vValue }; use rand::prelude::*; use rusoto_core::HttpClient; -use rusoto_credential::{StaticProvider}; +use rusoto_credential::{AwsCredentials, StaticProvider}; use rusoto_s3::S3Client; use crate::cryptoblob::*; @@ -120,16 +120,19 @@ impl Credentials { impl StorageCredentials { pub fn k2v_client(&self) -> Result { - let config = K2vClientConfig { - endpoint: self.k2v_region.endpoint.clone(), - region: self.k2v_region.name.clone(), - aws_access_key_id: self.aws_access_key_id.clone(), - aws_secret_access_key: self.aws_secret_access_key.clone(), - bucket: self.bucket.clone(), - user_agent: None, - }; - - Ok(K2vClient::new(config)?) + let aws_creds = AwsCredentials::new( + self.aws_access_key_id.clone(), + self.aws_secret_access_key.clone(), + None, + None, + ); + + Ok(K2vClient::new( + self.k2v_region.as_rusoto_region(), + self.bucket.clone(), + aws_creds, + None, + )?) } pub fn s3_client(&self) -> Result { @@ -138,8 +141,16 @@ impl StorageCredentials { self.aws_secret_access_key.clone(), ); + let connector = hyper_rustls::HttpsConnectorBuilder::new() + .with_native_roots() + .https_or_http() + .enable_http1() + .enable_http2() + .build(); + let client = HttpClient::from_connector(connector); + Ok(S3Client::new_with( - HttpClient::new()?, + client, aws_creds_provider, self.s3_region.as_rusoto_region(), )) -- cgit v1.2.3