Skip to main content

Crate domain_status

Crate domain_status 

Source
Expand description

domain_status library: core URL scanning functionality

This library provides high-level APIs for scanning URLs and capturing comprehensive metadata including HTTP status, TLS certificates, DNS information, technology fingerprints, and more.

§Example

use domain_status::{Config, run_scan};
use tokio;

let config = Config {
    file: std::path::PathBuf::from("urls.txt"),
    max_concurrency: 50,
    rate_limit_rps: 20,
    ..Default::default()
};

let report = run_scan(config).await?;
println!("Processed {} URLs: {} succeeded, {} failed",
         report.total_urls, report.successful, report.failed);

§Requirements

This library requires a Tokio runtime. Use #[tokio::main] in your application or ensure you’re calling library functions within an async context.

§Stability and API guarantees

  • Stable: Exit codes (see project docs), Config validation rules, and public function signatures and types follow SemVer.
  • Primary embed API: Config + run_scan + export + summary (+ typed errors / exit codes).
  • Advanced (may narrow further in 0.x): whois, GeoIpService, cli.
  • Crate-private: initialization helpers, most config constants/header names, fetch/fingerprint/storage internals.
  • May change: Exact wording of error messages, the internal error chain and downcasting behavior, and default config values (e.g. timeouts, limits) may change in patch or minor releases to improve safety or diagnostics.

Re-exports§

pub use cli::evaluate_exit_code;
pub use config::Config;
pub use config::ScanDependencyOverrides;
pub use exit_codes::EXIT_NO_URLS_PCT;
pub use exit_codes::EXIT_POLICY_FAILURE;
pub use exit_codes::EXIT_RUNTIME_ERROR;
pub use exit_codes::EXIT_SUCCESS;
pub use summary::format_scan_summary;
pub use summary::query_scan_summary;
pub use summary::ScanSummary;
pub use summary::SummaryOptions;
pub use whois::lookup_whois;
pub use whois::WhoisResult;

Modules§

cli
CLI parsing and command execution.
config
Application configuration and constants.
exit_codes
Named exit codes for the domain-status binary.
export
Export url_status rows (plus satellites) to CSV, JSONL, or Parquet.
summary
Post-scan summary over an existing SQLite database.
whois
WHOIS/RDAP domain lookup using whois-service crate

Structs§

GeoIpService
Owned GeoIP service that can be instantiated in tests without relying on process-global state.
RunSummary
Summary of a completed run, suitable for displaying run history.
ScanReport
Results of a URL scanning run.
UrlRecord
Represents a complete URL status record for database insertion.

Enums§

DatabaseError
Error types for database operations.
FailOn
Exit code policy for handling failures.
FingerprintError
Error types for technology fingerprinting operations.
KeyAlgorithm
Public key algorithm used in a TLS certificate.
LogFormat
Log output format.
LogLevel
Logging level for the application.
MigrationError
Error types for run_migrations.
RunScanError
Error returned by run_scan: either during setup (startup) or during the main loop (runtime).
StartupError
Errors that occur before or during scan setup (config, init, bind).
StatusServerLifecycleError
Lifecycle errors for spawn_status_server and StatusServerHandle::shutdown.
TlsVersion
TLS protocol version negotiated during an HTTPS connection.

Traits§

ErrorExt
Extension trait for errors that formats the full error chain.
ReqwestErrorExt
Extension trait for reqwest::Error providing categorization and retriability.

Functions§

init_db_pool_with_path
Initializes and returns a database connection pool with an explicit path.
log_error_chain
Logs each cause in an error chain with log::error!.
print_io_error_hint_if_applicable
If the error chain contains an IO or path-related error, prints a short hint to stderr.
query_run_history
Query run history from the database.
run_migrations
Runs SQLx migrations embedded in the binary.
run_scan
Runs a URL scan with the provided configuration.