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.
  • 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::FailOn;
pub use config::LogFormat;
pub use config::LogLevel;
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 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 functionality for domain_status data.
initialization
Application initialization and resource setup.
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.
UrlRecordInsertParams
Parameters for inserting a URL record.

Enums§

DatabaseError
Error types for database operations.
FingerprintError
Error types for technology fingerprinting operations.
KeyAlgorithm
Public key algorithm used in a TLS certificate.
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).
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.
insert_url_record
Inserts a UrlRecord into the database with retry logic for transient errors.
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.