2023-05-17 13:47:40 +00:00
|
|
|
pub mod acme;
|
2023-05-07 15:06:51 +00:00
|
|
|
pub mod checker;
|
2023-07-09 13:08:33 +00:00
|
|
|
mod config;
|
2023-05-10 11:34:33 +00:00
|
|
|
pub mod manager;
|
2023-07-09 12:25:01 +00:00
|
|
|
mod name;
|
|
|
|
pub mod store;
|
2023-05-12 13:19:24 +00:00
|
|
|
|
2023-07-09 13:08:33 +00:00
|
|
|
pub use config::*;
|
2023-07-09 12:25:01 +00:00
|
|
|
pub use name::*;
|
2023-05-12 13:19:24 +00:00
|
|
|
|
2023-07-09 12:25:01 +00:00
|
|
|
use crate::error::unexpected::{self, Mappable};
|
|
|
|
use crate::origin;
|
2023-05-12 13:19:24 +00:00
|
|
|
|
2023-07-09 12:25:01 +00:00
|
|
|
use hex::ToHex;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use sha2::{Digest, Sha256};
|
2023-05-12 13:19:24 +00:00
|
|
|
|
2023-07-09 12:25:01 +00:00
|
|
|
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
|
|
|
|
/// Defines how a domain will behave when it is accessed. These are configured by the owner of the
|
|
|
|
/// domain during setup.
|
2023-07-16 12:38:48 +00:00
|
|
|
pub struct Settings {
|
2023-07-16 15:43:16 +00:00
|
|
|
#[serde(flatten)]
|
2023-07-09 12:25:01 +00:00
|
|
|
pub origin_descr: origin::Descr,
|
2023-05-12 13:19:24 +00:00
|
|
|
}
|
|
|
|
|
2023-07-16 12:38:48 +00:00
|
|
|
impl Settings {
|
2023-07-09 12:25:01 +00:00
|
|
|
pub fn hash(&self) -> Result<String, unexpected::Error> {
|
|
|
|
let mut h = Sha256::new();
|
|
|
|
serde_json::to_writer(&mut h, self).or_unexpected()?;
|
|
|
|
Ok(h.finalize().encode_hex::<String>())
|
2023-05-12 13:19:24 +00:00
|
|
|
}
|
|
|
|
}
|