Skip to content
Snippets Groups Projects
Commit 32fe5cdd authored by Ian Jackson's avatar Ian Jackson
Browse files

arti: Make main module entrypoints pub

This does not constitute any kind of stable API promise.
But it might allow people to use our arti client code in novel ways.
parent 4ae5f11c
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@ use crate::Result;
/// This function can have pretty kludgy side-effects: see
/// documentation for `tokio::signal::ctrl_c` and `async_ctrlc` for
/// caveats. Notably, you can only call this once with async_std.
pub(crate) async fn wait_for_ctrl_c() -> Result<()> {
pub async fn wait_for_ctrl_c() -> Result<()> {
#[cfg(feature = "tokio")]
{
tokio_crate::signal::ctrl_c().await?;
......
......@@ -81,11 +81,11 @@
//! a command line program similar to `arti`.
//! The API should not be considered stable.
mod exit;
mod process;
mod proxy;
mod trace;
mod watch_cfg;
pub mod exit;
pub mod process;
pub mod proxy;
pub mod trace;
pub mod watch_cfg;
use arti_client::{TorClient, TorClientConfig};
use arti_config::{default_config_file, ArtiConfig};
......@@ -98,7 +98,7 @@ use tracing::{info, warn};
use std::convert::TryInto;
/// Run the main loop of the proxy.
async fn run<R: Runtime>(
pub async fn run<R: Runtime>(
runtime: R,
socks_port: u16,
config_sources: arti_config::ConfigurationSources,
......@@ -131,7 +131,7 @@ async fn run<R: Runtime>(
}
/// Inner function to allow convenient error handling
fn main_main() -> Result<()> {
pub fn main_main() -> Result<()> {
// We describe a default here, rather than using `default()`, because the
// correct behavior is different depending on whether the filename is given
// explicitly or not.
......
......@@ -10,7 +10,7 @@ use arti_client::TorClientConfig;
/// # Limitations
///
/// This doesn't actually do anything on windows.
pub(crate) fn use_max_file_limit(config: &TorClientConfig) {
pub fn use_max_file_limit(config: &TorClientConfig) {
match rlimit::increase_nofile_limit(config.system.max_files) {
Ok(n) => tracing::debug!("Increased process file limit to {}", n),
Err(e) => tracing::warn!("Error while increasing file limit: {}", e),
......
......@@ -23,7 +23,7 @@ use anyhow::{anyhow, Context, Result};
/// Find out which kind of address family we can/should use for a
/// given `SocksRequest`.
fn stream_preference(req: &SocksRequest, addr: &str) -> StreamPrefs {
pub fn stream_preference(req: &SocksRequest, addr: &str) -> StreamPrefs {
let mut prefs = StreamPrefs::new();
if addr.parse::<Ipv4Addr>().is_ok() {
// If they asked for an IPv4 address correctly, nothing else will do.
......@@ -421,7 +421,7 @@ fn accept_err_is_fatal(err: &IoError) -> bool {
/// Requires a `runtime` to use for launching tasks and handling
/// timeouts, and a `tor_client` to use in connecting over the Tor
/// network.
pub(crate) async fn run_socks_proxy<R: Runtime>(
pub async fn run_socks_proxy<R: Runtime>(
runtime: R,
tor_client: TorClient<R>,
socks_port: u16,
......
......@@ -119,7 +119,7 @@ where
/// Opaque structure that gets dropped when the program is shutting down,
/// after logs are no longer needed. The `Drop` impl flushes buffered messages.
pub(crate) struct LogGuards {
pub struct LogGuards {
/// The actual list of guards we're returning.
#[allow(unused)]
guards: Vec<WorkerGuard>,
......@@ -129,7 +129,7 @@ pub(crate) struct LogGuards {
///
/// Note that the returned LogGuard must be dropped precisely when the program
/// quits; they're used to ensure that all the log messages are flushed.
pub(crate) fn setup_logging(config: &LoggingConfig, cli: Option<&str>) -> Result<LogGuards> {
pub fn setup_logging(config: &LoggingConfig, cli: Option<&str>) -> Result<LogGuards> {
// Important: We have to make sure that the individual layers we add here
// are not filters themselves. That means, for example, that we can't add
// an `EnvFilter` layer unless we want it to apply globally to _all_ layers.
......
......@@ -20,7 +20,7 @@ const POLL_INTERVAL: Duration = Duration::from_secs(10);
///
/// Whenever one or more files in `files` changes, try to reload our
/// configuration from them and tell TorClient about it.
pub(crate) fn watch_for_config_changes<R: Runtime>(
pub fn watch_for_config_changes<R: Runtime>(
sources: arti_config::ConfigurationSources,
original: ArtiConfig,
client: TorClient<R>,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment