2020-07-10 18:15:41 +00:00
|
|
|
#[macro_use]
|
2020-12-21 23:27:42 +00:00
|
|
|
extern crate strum_macros;
|
2021-08-04 21:13:51 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate smart_default;
|
2020-07-10 18:15:41 +00:00
|
|
|
|
2020-09-14 15:29:50 +00:00
|
|
|
pub mod apub;
|
|
|
|
pub mod email;
|
2020-12-21 23:27:42 +00:00
|
|
|
pub mod rate_limit;
|
2020-07-10 18:15:41 +00:00
|
|
|
pub mod settings;
|
2021-03-01 17:24:11 +00:00
|
|
|
|
2021-09-20 15:46:34 +00:00
|
|
|
pub mod claims;
|
2022-06-02 14:33:41 +00:00
|
|
|
pub mod error;
|
2022-05-03 17:44:13 +00:00
|
|
|
pub mod request;
|
2020-09-14 15:29:50 +00:00
|
|
|
pub mod utils;
|
2021-02-09 18:26:06 +00:00
|
|
|
pub mod version;
|
2020-07-10 18:15:41 +00:00
|
|
|
|
2022-11-26 20:34:38 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
2022-06-02 14:33:41 +00:00
|
|
|
use std::{fmt, time::Duration};
|
2022-11-26 20:34:38 +00:00
|
|
|
use url::Url;
|
2020-09-01 14:25:34 +00:00
|
|
|
|
|
|
|
pub type ConnectionId = usize;
|
2021-03-18 20:25:21 +00:00
|
|
|
|
2022-03-24 16:33:23 +00:00
|
|
|
pub const REQWEST_TIMEOUT: Duration = Duration::from_secs(10);
|
|
|
|
|
2021-03-18 20:25:21 +00:00
|
|
|
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
|
|
|
|
pub struct IpAddr(pub String);
|
|
|
|
|
|
|
|
impl fmt::Display for IpAddr {
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
write!(f, "{}", self.0)
|
|
|
|
}
|
|
|
|
}
|
2020-07-10 18:15:41 +00:00
|
|
|
|
2022-11-26 20:34:38 +00:00
|
|
|
#[derive(Serialize, Deserialize, Debug)]
|
|
|
|
pub struct WebfingerLink {
|
|
|
|
pub rel: Option<String>,
|
|
|
|
#[serde(rename = "type")]
|
|
|
|
pub kind: Option<String>,
|
|
|
|
pub href: Option<Url>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Serialize, Deserialize, Debug)]
|
|
|
|
pub struct WebfingerResponse {
|
|
|
|
pub subject: String,
|
|
|
|
pub links: Vec<WebfingerLink>,
|
|
|
|
}
|
|
|
|
|
2020-08-11 14:31:05 +00:00
|
|
|
#[macro_export]
|
|
|
|
macro_rules! location_info {
|
|
|
|
() => {
|
|
|
|
format!(
|
|
|
|
"None value at {}:{}, column {}",
|
|
|
|
file!(),
|
|
|
|
line!(),
|
|
|
|
column!()
|
|
|
|
)
|
|
|
|
};
|
|
|
|
}
|