Skip to content

Commit 440ae18

Browse files
feat: implements oauthless auth backend and change http client
* Switch from hyper 0.x http client to full-featured reqwest (hyper-based 1.x) http client * Remove connectors as they are fully handled by reqwest transparently * Correct some comments * Rename trace feature into tracing Signed-off-by: Florentin Dubois <[email protected]>
1 parent fba4c64 commit 440ae18

File tree

7 files changed

+256
-707
lines changed

7 files changed

+256
-707
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
fail-fast: true
1010
matrix:
1111
rust:
12-
- 1.64.0
12+
- 1.84.1
1313
- stable
1414
- beta
1515
- nightly
@@ -31,7 +31,7 @@ jobs:
3131
fail-fast: true
3232
matrix:
3333
rust:
34-
- 1.64.0
34+
- 1.84.1
3535
- stable
3636
- beta
3737
- nightly

Cargo.toml

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,54 +19,47 @@ keywords = [
1919
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
2020

2121
[dependencies]
22-
async-trait = { version = "^0.1.72", optional = true }
23-
base64 = { version = "^0.21.2", optional = true }
24-
bytes = { version = "^1.4.0", features = ["serde"], optional = true }
25-
cidr = { version = "^0.2.2", optional = true }
22+
async-trait = { version = "^0.1.86", optional = true }
23+
base64 = { version = "^0.22.1", optional = true }
24+
bytes = { version = "^1.10.0", features = ["serde"], optional = true }
25+
cidr = { version = "^0.3.1", optional = true }
2626
crypto-common = { version = "^0.1.6", optional = true }
27-
headers = { version = "^0.3.8", optional = true }
2827
hmac = { version = "^0.12.1", features = ["std"], optional = true }
29-
hyper = { version = "^0.14.27", default-features = false, optional = true }
30-
hyper-rustls = { version = "^0.24.0", default-features= false, features = ["webpki-tokio", "http1", "tls12"], optional = true }
31-
hyper-proxy = { version = "^0.9.1", default-features = false, features = ["rustls-webpki"], optional = true }
32-
once_cell = { version = "^1.18.0", optional = true }
33-
log = { version = "^0.4.19", optional = true }
34-
prometheus = { version = "^0.13.3", optional = true }
35-
serde = { version = "^1.0.179", features = ["derive"], optional = true }
36-
serde_json = { version = "^1.0.104", features = [
28+
log = { version = "^0.4.21", optional = true }
29+
prometheus = { version = "^0.13.4", optional = true }
30+
reqwest = { version = "^0.12.12", default-features = true, features = ["rustls-tls-webpki-roots", "charset", "http2", "gzip", "deflate", "zstd", "json", "hickory-dns"], optional = true }
31+
serde = { version = "^1.0.217", features = ["derive"], optional = true }
32+
serde_json = { version = "^1.0.138", features = [
3733
"preserve_order",
3834
"float_roundtrip",
3935
], optional = true }
40-
sha2 = { version = "^0.10.7", optional = true }
41-
thiserror = { version = "^1.0.44", optional = true }
42-
tracing = { version = "^0.1.37", optional = true }
36+
sha2 = { version = "^0.10.8", optional = true }
37+
thiserror = { version = "^2.0.11", optional = true }
38+
tracing = { version = "^0.1.41", optional = true }
4339
tracing-futures = { version = "^0.2.5", optional = true }
44-
url = { version = "^2.4.0", default-features = false, features = ["serde"], optional = true }
40+
url = { version = "^2.5.4", default-features = false, features = ["serde"], optional = true }
4541
urlencoding = { version = "^2.1.3", optional = true }
46-
uuid = { version = "^1.4.1", features = ["serde", "v4"], optional = true }
42+
uuid = { version = "^1.13.1", features = ["serde", "v4"], optional = true }
4743

4844
[features]
49-
default = ["client", "proxy", "logging"]
45+
default = ["client", "logging"]
5046
client = [
5147
"async-trait",
5248
"base64",
5349
"bytes",
50+
"cidr",
5451
"crypto-common",
5552
"hmac",
56-
"hyper",
57-
"hyper/client",
58-
"hyper/tcp",
59-
"hyper/http1",
60-
"hyper-rustls",
53+
"reqwest",
6154
"serde",
6255
"serde_json",
6356
"sha2",
6457
"thiserror",
58+
"url",
6559
"urlencoding",
6660
"uuid",
6761
]
68-
logging = ["log", "tracing/log-always", "hyper-rustls/logging"]
69-
trace = ["tracing", "tracing-futures"]
62+
logging = ["log", "tracing/log-always"]
63+
tracing = ["dep:tracing", "tracing-futures"]
7064
tokio = ["tracing-futures/tokio"]
71-
metrics = ["once_cell", "prometheus"]
72-
proxy = ["cidr", "headers", "hyper-proxy", "url"]
65+
metrics = ["prometheus"]

README.md

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,11 @@ Below, you will find an example of executing a simple request to an api.
2424
```rust
2525
use std::error::Error;
2626

27-
use oauth10a::client::{Client, Credentials, RestClient, proxy::ProxyConnectorBuilder};
27+
use oauth10a::client::{Client, Credentials, RestClient};
2828

2929
#[tokio::main]
3030
async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
31-
let connector = ProxyConnectorBuilder::try_from_env()?;
32-
let client = Client::builder()
33-
.with_credentials(Credentials {
34-
token: "".to_string(),
35-
secret: "".to_string(),
36-
consumer_key: "".to_string(),
37-
consumer_secret: "".to_string(),
38-
})
39-
.build(connector);
40-
31+
let client = Client::from(Credentials::oauth1("".to_string(), "".to_string(), "".to_string(), "".to_string()));
4132
let _obj: BtreeMap<String, String> = client.get("https://example.com/object.json").await?;
4233

4334
Ok(())
@@ -46,13 +37,13 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
4637

4738
## Features
4839

49-
| name | description |
50-
| ------- |---------------------------------------------------------------------------|
51-
| default | Default enable features are `client`, `logging`, `proxy` |
52-
| client | The oauth 1.0a client implementation |
53-
| logging | Use the `log` facility crate to print logs |
54-
| metrics | Use `once_cell` and `prometheus` crates to register metrics |
55-
| proxy | Enable the support of environment variable `http_proxy` and `https_proxy` |
40+
| name | description |
41+
|---------|---------------------------------------------------------------|
42+
| default | Default enable features are `client` and `logging` |
43+
| client | The oauth 1.0a client implementation |
44+
| logging | Use the `log` facility crate to print logs |
45+
| metrics | Use `prometheus` crates to register metrics |
46+
| tracing | Use `tracing` crate to add `tracing::instrument` on functions |
5647

5748
### Metrics
5849

src/client/connector.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)