Skip to main content

Crate adler_server

Crate adler_server 

Source
Expand description

HTTP server for the Adler OSINT username-search engine.

This crate hosts the JSON API that the upcoming SolidJS web UI talks to. It is a thin shell around adler_core: scans run through the same adler_core::executor the CLI uses, and the same adler_core::Client is shared across all in-process scans.

§Quick start

use std::net::SocketAddr;
use adler_core::{Client, Registry};
use adler_server::{AppConfig, serve};

let registry = Registry::default_embedded()?;
// Use the caller's filtering rules — the CLI already exposes
// --only/--tag/--exclude, so the server just runs whatever site
// list it's handed.
let sites = registry.filter(&[], &[], &[], &[], false);
let client = Client::builder().build()?;
let config = AppConfig {
    bind: "127.0.0.1:8765".parse::<SocketAddr>()?,
    scan_capacity: 32,
    scans_dir: None, // or Some(adler_server::default_scans_dir())
};
serve(sites, client, config).await?;

§Routes

RouteMethodPurpose
/api/healthGETliveness
/api/sitesGETsite catalogue
/api/scanPOSTstart a scan, returns a scan_id
/api/scan/{id}GETpoll status / final aggregate
/api/scan/{id}/streamGETServer-Sent Events
/GETplaceholder HTML (SPA TBD)

§Threading and shutdown

serve binds the TCP listener, installs a SIGINT / SIGTERM graceful-shutdown signal, and runs until the listener closes. All state (registry, client, in-flight scans) lives in an AppState cloned into each handler — no global mutables.

Structs§

AppConfig
Server configuration.
AppState
State shared across all axum handlers.
FinishedScan
Aggregate published once a scan finishes.
PersistedScan
Self-contained snapshot of a completed scan. Round-trips losslessly through JSON; tests assert that.
ScanHandle
Live state of one scan.
ScanId
Identifier for a running or finished scan.
Summary
Verdict counts for a finished scan.

Enums§

Error
Errors surfaced by the public serve entry point.

Functions§

default_scans_dir
Default directory for persisted scans.
router
Build the axum router. Public so test harnesses can drive it directly without going through crate::serve.
serve
Run the server until the listener closes or a shutdown signal arrives.

Type Aliases§

Result
Result<T, Error> alias used throughout the crate.