forked from lavina/lavina
1
0
Fork 0

well known endpoint protocol

This commit is contained in:
Nikita Vilunov 2023-01-25 16:48:52 +04:00
parent d94d03466a
commit 98dd702be6
6 changed files with 58 additions and 6 deletions

32
Cargo.lock generated
View File

@ -8,6 +8,17 @@ version = "1.0.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61"
[[package]]
name = "async-trait"
version = "0.1.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eff18d764974428cf3a9328e23fc5c986f5fbed46e6cd4cdf42544df5d297ec1"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "atomic"
version = "0.5.1"
@ -196,6 +207,15 @@ dependencies = [
"tracing-subscriber",
]
[[package]]
name = "lavina_proto"
version = "0.1.0"
dependencies = [
"anyhow",
"async-trait",
"serde",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
@ -337,9 +357,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "proc-macro2"
version = "1.0.49"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5"
checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2"
dependencies = [
"unicode-ident",
]
@ -457,9 +477,9 @@ dependencies = [
[[package]]
name = "tokio"
version = "1.24.1"
version = "1.24.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d9f76183f91ecfb55e1d7d5602bd1d979e38a3a522fe900241cf195624d67ae"
checksum = "597a12a59981d9e3c38d216785b0c37399f6e415e8d0712047620f189371b0bb"
dependencies = [
"autocfg",
"bytes",
@ -488,9 +508,9 @@ dependencies = [
[[package]]
name = "toml"
version = "0.5.10"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f"
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
dependencies = [
"serde",
]

View File

@ -1,3 +1,8 @@
[workspace]
members = [
"crates/*"
]
[package]
name = "lavina"
version = "0.1.0"

9
crates/proto/Cargo.toml Normal file
View File

@ -0,0 +1,9 @@
[package]
name = "lavina_proto"
version = "0.1.0"
edition = "2021"
[dependencies]
anyhow = "1.0.68"
async-trait = "0.1.63"
serde = { version = "1.0.152", features = ["serde_derive"] }

2
crates/proto/src/lib.rs Normal file
View File

@ -0,0 +1,2 @@
mod prelude;
pub mod well_known;

View File

@ -0,0 +1,3 @@
pub type Result<T> = std::result::Result<T, anyhow::Error>;
pub use async_trait::async_trait;
pub use serde::{Deserialize, Serialize};

View File

@ -0,0 +1,13 @@
use crate::prelude::*;
#[derive(Serialize, Deserialize)]
pub struct ServerInfo {
pub name: String,
pub user_api_base_url: String,
pub fedi_api_base_url: String,
}
#[async_trait]
pub trait WellKnown {
async fn well_known(&self) -> Result<ServerInfo>;
}