Struct goatns::config::ConfigFile
source · pub struct ConfigFile {Show 27 fields
pub hostname: String,
pub address: String,
pub port: u16,
pub capture_packets: bool,
pub log_level: String,
pub tcp_client_timeout: u64,
pub enable_hinfo: bool,
pub sqlite_path: String,
pub zone_file: Option<String>,
pub allowed_tlds: Vec<String>,
pub ip_allow_lists: IPAllowList,
pub enable_api: bool,
pub api_port: u16,
pub api_tls_cert: PathBuf,
pub api_tls_key: PathBuf,
pub api_static_dir: String,
api_cookie_secret: String,
pub oauth2_client_id: String,
pub oauth2_redirect_url: Url,
pub oauth2_secret: String,
pub oauth2_config_url: String,
pub oauth2_user_scopes: Vec<String>,
pub sql_log_statements: bool,
pub sql_log_slow_duration: u64,
pub sql_db_cleanup_seconds: u64,
pub admin_contact: ContactDetails,
pub user_auto_provisioning: bool,
}Expand description
The main config blob for GoatNS, write this as a JSON file and load it and it’ll make things go.
Fields§
§hostname: StringThe server’s hostname when generating an SOA record, defaults to the results of gethostname()
address: StringDNS listener address, default is 127.0.0.1
port: u16Listen for DNS queries on this port, default is 15353
capture_packets: boolIf we should capture packets on request/response
log_level: StringDefault is “DEBUG”
tcp_client_timeout: u64How long until we drop TCP client connections, defaults to 5 seconds.
enable_hinfo: boolEnable a HINFO record at hinfo.goat
sqlite_path: StringThe location for the zone sqlite file
zone_file: Option<String>Where the JSON zone file is
allowed_tlds: Vec<String>List of “valid” TLDs - if this is empty let anything be created
ip_allow_lists: IPAllowListIP Allow lists
enable_api: boolDo you really want an API?
api_port: u16API / Web UI Port
api_tls_cert: PathBufCertificate path
api_tls_key: PathBufTLS key path
api_static_dir: StringStatic File Directory for api things
Secret for cookie storage - it’ll randomly generate on startup by default
oauth2_client_id: StringOAuth2 Resource server name
oauth2_redirect_url: UrlIf your instance is behind a proxy/load balancer/whatever, you need to specify this, eg https://example.com:12345
oauth2_secret: StringOauth2 Secret
oauth2_config_url: StringOIDC Discovery URL, eg for Kanidm you’d use https://idm.example.com/oauth2/openid/:client_id:/.well-known/openid-configuration
oauth2_user_scopes: Vec<String>A list of scopes to request from the IdP
sql_log_statements: boolLog things sometimes
sql_log_slow_duration: u64When queries take more than this many seconds, log them
sql_db_cleanup_seconds: u64Clean up sessions table every n seconds
admin_contact: ContactDetailsAdministrator contact details
user_auto_provisioning: boolAllow auto-provisioning of users
Implementations§
source§impl ConfigFile
impl ConfigFile
sourcepub fn as_json_pretty(&self) -> Result<String, String>
pub fn as_json_pretty(&self) -> Result<String, String>
JSONify the configfile in a pretty way using serde
sourcepub fn dns_listener_address(&self) -> Result<SocketAddr, Option<String>>
pub fn dns_listener_address(&self) -> Result<SocketAddr, Option<String>>
Get a bindable SocketAddr for use in the DNS listeners
sourcepub fn api_listener_address(&self) -> SocketAddr
pub fn api_listener_address(&self) -> SocketAddr
get a string version of the listener address
It’s a sekret!
pub fn status_url(&self) -> Url
pub async fn get_tls_config(&self) -> Result<RustlsConfig, String>
pub async fn check_config( config: CowCellWriteTxn<'_, ConfigFile> ) -> Result<(), Vec<String>>
sourcepub fn try_as_cowcell(
config_path: Option<&String>
) -> Result<CowCell<ConfigFile>, Error>
pub fn try_as_cowcell( config_path: Option<&String> ) -> Result<CowCell<ConfigFile>, Error>
Uses Self::try_from and wraps it in a CowCell (moo)
The default locations are ~/.config/goatns.json and ./goatns.json.
Trait Implementations§
source§impl Clone for ConfigFile
impl Clone for ConfigFile
source§fn clone(&self) -> ConfigFile
fn clone(&self) -> ConfigFile
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for ConfigFile
impl Debug for ConfigFile
source§impl Default for ConfigFile
impl Default for ConfigFile
source§impl<'de> Deserialize<'de> for ConfigFile
impl<'de> Deserialize<'de> for ConfigFile
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>,
source§impl Display for ConfigFile
impl Display for ConfigFile
source§impl From<Config> for ConfigFile
impl From<Config> for ConfigFile
source§impl FromRef<GoatChildState> for ConfigFile
impl FromRef<GoatChildState> for ConfigFile
source§fn from_ref(state: &GoatChildState) -> Self
fn from_ref(state: &GoatChildState) -> Self
source§impl FromStr for ConfigFile
impl FromStr for ConfigFile
source§impl PartialEq for ConfigFile
impl PartialEq for ConfigFile
source§fn eq(&self, other: &ConfigFile) -> bool
fn eq(&self, other: &ConfigFile) -> bool
self and other values to be equal, and is used
by ==.source§impl Serialize for ConfigFile
impl Serialize for ConfigFile
impl Eq for ConfigFile
impl StructuralEq for ConfigFile
impl StructuralPartialEq for ConfigFile
Auto Trait Implementations§
impl RefUnwindSafe for ConfigFile
impl Send for ConfigFile
impl Sync for ConfigFile
impl Unpin for ConfigFile
impl UnwindSafe for ConfigFile
Blanket Implementations§
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> Conv for T
impl<T> Conv for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§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>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.