pub struct CertificateStore { /* private fields */ }Expand description
Certificate store with database metadata and file caching.
Implementations§
Source§impl CertificateStore
impl CertificateStore
Sourcepub async fn new(pool: PgPool, cache_dir: impl AsRef<Path>) -> ProxyResult<Self>
pub async fn new(pool: PgPool, cache_dir: impl AsRef<Path>) -> ProxyResult<Self>
Create a new certificate store.
The cache directory holds private keys, so it is created owner-only
(0700) and every key in it is kept at 0600. A directory that already
exists is left as it is – cert_dir might be a shared path, and
tightening it could break whatever else uses it – but a warning says
so if others can read it, and key files written by earlier versions,
which were left at the umask’s default (typically world-readable), are
tightened.
Sourcepub async fn get(&self, domain: &str) -> Option<Certificate>
pub async fn get(&self, domain: &str) -> Option<Certificate>
Get a certificate for a domain.
None for a name that is not a valid lowercase DNS name: see
[check_domain].
Sourcepub async fn save(&self, cert: Certificate) -> ProxyResult<()>
pub async fn save(&self, cert: Certificate) -> ProxyResult<()>
Save a certificate.
Refused unless cert.domain is a valid lowercase DNS name: see
[check_domain].
Sourcepub async fn remove(&self, domain: &str) -> ProxyResult<()>
pub async fn remove(&self, domain: &str) -> ProxyResult<()>
Remove a certificate.
Refused unless domain is a valid lowercase DNS name: see
[check_domain].
Sourcepub async fn list_domains(&self) -> ProxyResult<Vec<String>>
pub async fn list_domains(&self) -> ProxyResult<Vec<String>>
List all stored domains.
Sourcepub async fn load_all(&self) -> ProxyResult<Vec<Certificate>>
pub async fn load_all(&self) -> ProxyResult<Vec<Certificate>>
Read every certificate from the database, ignoring both caches.
get answers from memory once a domain has been read
once, which is right for a handshake and wrong for a refresh: a
certificate renewed by another instance would never be noticed, and
this proxy would go on serving the old one until it was restarted. The
database is the authority, so a refresh asks it.
The in-memory cache is replaced with what was read, so the two do not then disagree.
Auto Trait Implementations§
impl !Freeze for CertificateStore
impl !RefUnwindSafe for CertificateStore
impl !UnwindSafe for CertificateStore
impl Send for CertificateStore
impl Sync for CertificateStore
impl Unpin for CertificateStore
impl UnsafeUnpin for CertificateStore
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more