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: String
The server’s hostname when generating an SOA record, defaults to the results of gethostname()
address: String
DNS listener address, default is 127.0.0.1
port: u16
Listen for DNS queries on this port, default is 15353
capture_packets: bool
If we should capture packets on request/response
log_level: String
Default is “DEBUG”
tcp_client_timeout: u64
How long until we drop TCP client connections, defaults to 5 seconds.
enable_hinfo: bool
Enable a HINFO record at hinfo.goat
sqlite_path: String
The 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: IPAllowList
IP Allow lists
enable_api: bool
Do you really want an API?
api_port: u16
API / Web UI Port
api_tls_cert: PathBuf
Certificate path
api_tls_key: PathBuf
TLS key path
api_static_dir: String
Static File Directory for api things
Secret for cookie storage - it’ll randomly generate on startup by default
oauth2_client_id: String
OAuth2 Resource server name
oauth2_redirect_url: Url
If your instance is behind a proxy/load balancer/whatever, you need to specify this, eg https://example.com:12345
oauth2_secret: String
Oauth2 Secret
oauth2_config_url: String
OIDC 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: bool
Log things sometimes
sql_log_slow_duration: u64
When queries take more than this many seconds, log them
sql_db_cleanup_seconds: u64
Clean up sessions table every n seconds
admin_contact: ContactDetails
Administrator contact details
user_auto_provisioning: bool
Allow auto-provisioning of users
Implementations
sourceimpl ConfigFile
impl ConfigFile
sourcepub fn as_json_pretty(&self) -> String
pub fn as_json_pretty(&self) -> 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) -> RustlsConfig
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
sourceimpl Clone for ConfigFile
impl Clone for ConfigFile
sourcefn clone(&self) -> ConfigFile
fn clone(&self) -> ConfigFile
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for ConfigFile
impl Debug for ConfigFile
sourceimpl Default for ConfigFile
impl Default for ConfigFile
sourceimpl<'de> Deserialize<'de> for ConfigFile
impl<'de> Deserialize<'de> for ConfigFile
sourcefn 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>,
sourceimpl Display for ConfigFile
impl Display for ConfigFile
sourceimpl From<Config> for ConfigFile
impl From<Config> for ConfigFile
sourceimpl FromRef<GoatChildState> for ConfigFile
impl FromRef<GoatChildState> for ConfigFile
sourcefn from_ref(state: &GoatChildState) -> Self
fn from_ref(state: &GoatChildState) -> Self
sourceimpl FromStr for ConfigFile
impl FromStr for ConfigFile
sourceimpl PartialEq<ConfigFile> for ConfigFile
impl PartialEq<ConfigFile> for ConfigFile
sourcefn eq(&self, other: &ConfigFile) -> bool
fn eq(&self, other: &ConfigFile) -> bool
sourceimpl 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
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,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
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> FromRef<T> for Twhere
T: Clone,
impl<T> FromRef<T> for Twhere
T: Clone,
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn 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 morefn 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 morefn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
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) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
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)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Borrow<B>
of a value. Read morefn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
BorrowMut<B>
of a value. Read morefn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
AsRef<R>
view of a value. Read morefn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
AsMut<R>
view of a value. Read morefn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
Deref::Target
of a value. Read morefn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Deref::Target
of a value. Read morefn 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. Read morefn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
.tap_borrow()
only in debug builds, and is erased in release
builds. Read morefn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
.tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read morefn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
.tap_ref()
only in debug builds, and is erased in release
builds. Read morefn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
.tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more