DnsProvider

Trait DnsProvider 

Source
pub trait DnsProvider: Send + Sync {
    // Required methods
    fn create_record<'life0, 'life1, 'async_trait>(
        &'life0 self,
        subdomain: &'life1 str,
        proxied: bool,
    ) -> Pin<Box<dyn Future<Output = Result<String, DnsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_record<'life0, 'life1, 'async_trait>(
        &'life0 self,
        record_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), DnsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn create_origin_certificate<'life0, 'async_trait>(
        &'life0 self,
        validity_days: u32,
    ) -> Pin<Box<dyn Future<Output = Result<Option<OriginCertificate>, DnsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn cleanup_old_origin_certificates<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<u32, DnsError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for DNS and certificate management providers

This abstraction allows the server to work with different DNS backends, such as Cloudflare for production or a mock implementation for testing.

Required Methods§

Source

fn create_record<'life0, 'life1, 'async_trait>( &'life0 self, subdomain: &'life1 str, proxied: bool, ) -> Pin<Box<dyn Future<Output = Result<String, DnsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a DNS record for a subdomain

§Arguments
  • subdomain - The subdomain to create (e.g., “myapp”)
  • proxied - Whether to proxy through the provider (true for HTTP, false for TCP)
§Returns

The DNS record ID for later deletion

Source

fn delete_record<'life0, 'life1, 'async_trait>( &'life0 self, record_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), DnsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a DNS record by its ID

Source

fn create_origin_certificate<'life0, 'async_trait>( &'life0 self, validity_days: u32, ) -> Pin<Box<dyn Future<Output = Result<Option<OriginCertificate>, DnsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create an origin certificate for HTTPS

§Arguments
  • validity_days - Certificate validity in days
§Returns

An OriginCertificate if the provider supports it, None otherwise

Source

fn cleanup_old_origin_certificates<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u32, DnsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Clean up old origin certificates for this domain

§Returns

The number of certificates revoked

Implementors§