#[non_exhaustive]pub struct Config {
pub http: Option<HttpConfig>,
pub https: Option<HttpsConfig>,
pub dns: DnsConfig,
pub metrics: Option<MetricsConfig>,
pub mainline: Option<MainlineConfig>,
pub zone_store: Option<StoreConfig>,
pub pkarr_put_rate_limit: RateLimitConfig,
pub data_dir: Option<PathBuf>,
}Expand description
Top-level configuration for the server.
Usually loaded from a TOML file via Self::load. The Default impl
produces a config suitable for local development and testing.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.http: Option<HttpConfig>Configuration for the HTTP listener.
When None, no HTTP listener is started.
https: Option<HttpsConfig>Configuration for the HTTPS listener.
When None, no HTTPS listener is started.
dns: DnsConfigConfiguration for the DNS listener.
metrics: Option<MetricsConfig>Configuration for the metrics server.
When None, the metrics server binds to a default address. To disable
the metrics server entirely, use MetricsConfig::disabled.
mainline: Option<MainlineConfig>Configuration for the mainline DHT fallback.
When None or disabled, packets that are not present in the local store
are not looked up on the mainline DHT.
zone_store: Option<StoreConfig>Configuration for the signed-packet zone store.
When None, the defaults from StoreConfig::default are used.
pkarr_put_rate_limit: RateLimitConfigRate limit applied to PUT /pkarr requests.
data_dir: Option<PathBuf>Location where the server stores its data.
When None, Self::data_dir falls back to the IROH_DNS_DATA_DIR
environment variable, then to the platform’s standard data directory.
Implementations§
Source§impl Config
impl Config
Sourcepub async fn load(path: impl AsRef<Path>) -> Result<Config>
pub async fn load(path: impl AsRef<Path>) -> Result<Config>
Loads a Config from a TOML file at path.
Sourcepub fn data_dir(&self) -> Result<PathBuf>
pub fn data_dir(&self) -> Result<PathBuf>
Returns the data directory where the server stores its state.
Resolution order:
- The
Self::data_dirfield, if set. - The
IROH_DNS_DATA_DIRenvironment variable. - An
iroh-dnssubdirectory of the platform’s standard data directory, as reported bydirs_next::data_dir.
Sourcepub fn signed_packet_store_path(&self) -> Result<PathBuf>
pub fn signed_packet_store_path(&self) -> Result<PathBuf>
Returns the path to the signed-packet store database file.
The path is <data_dir>/signed-packets-1.db, where <data_dir> is
resolved by Self::data_dir.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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