[−][src]Struct routinator::config::Config
Routinator configuration.
This type contains both the basic configuration of Routinator, such as where to keep the repository and how to update it, as well as the configuration for server mode.
All values are public and can be accessed directly.
The two functions config_args
and server_args
can be used to
create the clap application. Its matches can then be used to create the
basic config via from_arg_matches
. If the RTR server configuration is
necessary, it can be added via apply_server_arg_matches
from the
server subcommand matches.
The methods init_logging
and switch_logging
can be used to
configure logging according to the strategy provided by the configuration.
On Unix systems only, the method daemonize
creates a correctly
configured Daemonizer
. Finally, to_toml
can be used to produce a
TOML value that contains a configuration file content representing the
current configuration.
Fields
cache_dir: PathBuf
Path to the directory that contains the repository cache.
tal_dir: PathBuf
Path to the directory that contains the trust anchor locators.
exceptions: Vec<PathBuf>
Paths to the local exceptions files.
strict: bool
Should we do strict validation?
See the relevant RPKI crate documentattion for more information.
disable_rsync: bool
Wether to disable rsync.
This is not currently changeable.
rsync_command: String
The command to run for rsync.
rsync_args: Option<Vec<String>>
Optional arguments passed to rsync.
If these are present, they overide the arguments automatically
determined otherwise. Thus, Some<Vec::new()>
will supress all
arguments.
rsync_timeout: Duration
Timeout for rsync commands.
disable_rrdp: bool
Wether to disable RRDP.
rrdp_timeout: Option<Option<Duration>>
Optional RRDP timeout in seconds.
If this is not set, the default timeouts of the reqwest
crate are
used. Use Some(None)
for no timeout.
rrdp_connect_timeout: Option<Duration>
Optional RRDP connect timeout in seconds.
rrdp_local_addr: Option<IpAddr>
Optional RRDP local address to bind to when doing requests.
rrdp_root_certs: Vec<PathBuf>
RRDP additional root certificates for HTTPS.
These do not overide the default system root certififcates.
rrdp_proxies: Vec<String>
RRDP HTTP proxies.
dirty_repository: bool
Wether to not cleanup the repository directory after a validation run.
If this is false
and update has not been disabled otherwise, all
data for rsync modules (if rsync is enabled) and RRDP servers (if
RRDP is enabled) that have not been used during validation will be
deleted.
validation_threads: usize
Number of threads used during validation.
refresh: Duration
The refresh interval for repository validation.
retry: Duration
The RTR retry inverval to be announced to a client.
expire: Duration
The RTR expire time to be announced to a client.
history_size: usize
How many diffs to keep in the history.
rtr_listen: Vec<SocketAddr>
Addresses to listen on for RTR TCP transport connections.
http_listen: Vec<SocketAddr>
Addresses to listen on for HTTP monitoring connectsion.
systemd_listen: bool
Whether to get the listening sockets from systemd.
log_level: LevelFilter
The log levels to be logged.
log_target: LogTarget
The target to log to.
pid_file: Option<PathBuf>
The optional PID file for daemon mode.
working_dir: Option<PathBuf>
The optional working directory for daemon mode.
chroot: Option<PathBuf>
The optional directory to chroot to in daemon mode.
user: Option<String>
The name of the user to change to in daemon mode.
group: Option<String>
The name of the group to change to in daemon mode.
Methods
impl Config
[src]
pub fn config_args<'a: 'b, 'b>(app: App<'a, 'b>) -> App<'a, 'b>
[src]
Adds the basic arguments to a clapp app.
The function follows clap’s builder pattern: it takes an app, adds a bunch of arguments to it and returns it at the end.
pub fn server_args<'a: 'b, 'b>(app: App<'a, 'b>) -> App<'a, 'b>
[src]
Adds the relevant config args to the server subcommand.
Some of the options in the config only make sense for the
RTR server. Having them in the global part of the clap command line
is confusing, so we stick to defaults unless we actually run the
server. This function adds the relevant arguments to the subcommand
provided via app
.
It follows clap’s builder pattern and returns the app with all arguments added.
pub fn from_arg_matches(
matches: &ArgMatches,
cur_dir: &Path
) -> Result<Self, Error>
[src]
matches: &ArgMatches,
cur_dir: &Path
) -> Result<Self, Error>
Creates a configuration from command line matches.
The function attempts to create configuration from the command line
arguments provided via matches
. It will try to read a config file
if provided via the config file option (-c
or --config
) or a
file in $HOME/.routinator.conf
otherwise. If the latter doesn’t
exist either, starts with a default configuration.
All relative paths given in command line arguments will be interpreted
relative to cur_dir
. Conversely, paths in the config file are
treated as relative to the config file’s directory.
If you are runming in server mode, you need to also apply the server
arguments via apply_server_arg_matches
.
pub fn apply_server_arg_matches(
&mut self,
matches: &ArgMatches,
cur_dir: &Path
) -> Result<(), Error>
[src]
&mut self,
matches: &ArgMatches,
cur_dir: &Path
) -> Result<(), Error>
Applies the RTR server command line arguments to an existing config.
All paths used in arguments are interpreted relative to cur_dir
.
pub fn init_logging() -> Result<(), Error>
[src]
Initialize logging.
All diagnostic output of Routinator is done via logging, never to
stderr directly. Thus, it is important to initalize logging before
doing anything else that may result in such output. This function
does exactly that. It sets a maximum log level of warn
, leading
only printing important information, and directs all logging to
stderr.
pub fn switch_logging(&self, daemon: bool) -> Result<(), Error>
[src]
Switches logging to the configured target.
Once the configuration has been successfully loaded, logging should be switched to whatever the user asked for via this method.
pub fn daemonize(&mut self) -> Result<Daemonize<()>, Error>
[src]
Returns a daemonizer based on the configuration.
This also changes the paths in the configuration if chroot
is set.
As this may fail, this whole method may fail.
pub fn to_toml(&self) -> Value
[src]
Returns a TOML representation of the config.
Trait Implementations
impl Clone for Config
[src]
impl Default for Config
[src]
impl Debug for Config
[src]
impl Display for Config
[src]
Auto Trait Implementations
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
impl RefUnwindSafe for Config
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
fn vzip(self) -> V
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,