mirror of
https://github.com/aljazceru/pubky-core.git
synced 2026-02-09 16:14:29 +01:00
chore(httprelay): upgrade dependencies
This commit is contained in:
14
Cargo.lock
generated
14
Cargo.lock
generated
@@ -137,9 +137,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.85"
|
||||
version = "0.1.86"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f934833b4b7233644e5848f235df3f57ed8c80f1528a26c3dfa13d2147fa056"
|
||||
checksum = "644dd749086bf3771a2fbc5f256fdb982d53f011c7d5d560304eafeecebce79d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -494,9 +494,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.28"
|
||||
version = "4.5.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3e77c3243bd94243c03672cb5154667347c457ca271254724f9f393aee1c05ff"
|
||||
checksum = "8acebd8ad879283633b343856142139f2da2317c96b05b4dd6181c61e2480184"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
@@ -504,9 +504,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.5.27"
|
||||
version = "4.5.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b26884eb4b57140e4d2d93652abfa49498b938b3c9179f9fc487b0acc3edad7"
|
||||
checksum = "f6ba32cbda51c7e1dfd49acc1457ba1a7dec5b64fe360e828acb13ca8dc9c2f9"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
@@ -1304,7 +1304,7 @@ name = "http-relay"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"axum 0.7.9",
|
||||
"axum 0.8.1",
|
||||
"axum-server",
|
||||
"futures-util",
|
||||
"tokio",
|
||||
|
||||
@@ -2,13 +2,20 @@
|
||||
name = "http-relay"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
authors = ["Nuh <nuh@nuh.dev>"]
|
||||
description = "A Rust implementation of _some_ of [Http relay spec](https://httprelay.io/)."
|
||||
license = "MIT"
|
||||
homepage = "https://github.com/pubky/pubky-core"
|
||||
repository = "https://github.com/pubky/pubky-core"
|
||||
keywords = ["httprelay", "http", "relay"]
|
||||
categories = ["web-programming"]
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.94"
|
||||
axum = "0.7.9"
|
||||
anyhow = "1.0.95"
|
||||
axum = "0.8.1"
|
||||
axum-server = "0.7.1"
|
||||
futures-util = "0.3.31"
|
||||
tokio = { version = "1.42.0", features = ["full"] }
|
||||
tokio = { version = "1.43.0", features = ["full"] }
|
||||
tracing = "0.1.41"
|
||||
url = "2.5.4"
|
||||
tower-http = { version = "0.6.2", features = ["cors", "trace"] }
|
||||
|
||||
@@ -5,3 +5,25 @@ A Rust implementation of _some_ of [Http relay spec](https://httprelay.io/).
|
||||
Normally you are better off running the [reference implementation's binary](https://httprelay.io/download/).
|
||||
|
||||
This implementation, for the time being is meant for having a convenient library to be used in unit tests, and testnets in Pubky.
|
||||
|
||||
## Usage
|
||||
|
||||
```rust
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let http_relay = http_relay::HttpRelay::builder()
|
||||
.http_port(15412)
|
||||
.build()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
println!(
|
||||
"Running http relay {}",
|
||||
http_relay.local_link_url().as_str()
|
||||
);
|
||||
|
||||
tokio::signal::ctrl_c().await.unwrap();
|
||||
|
||||
http_relay.shutdown();
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
//! A Rust implementation of _some_ of [Http relay spec](https://httprelay.io/).
|
||||
//!
|
||||
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
net::{SocketAddr, TcpListener},
|
||||
@@ -69,7 +72,7 @@ impl HttpRelay {
|
||||
let shared_state: SharedState = Arc::new(Mutex::new(HashMap::new()));
|
||||
|
||||
let app = Router::new()
|
||||
.route("/link/:id", get(link::get).post(link::post))
|
||||
.route("/link/{id}", get(link::get).post(link::post))
|
||||
.layer(CorsLayer::very_permissive())
|
||||
.layer(TraceLayer::new_for_http())
|
||||
.with_state(shared_state);
|
||||
|
||||
Reference in New Issue
Block a user