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
| Route | Method | Purpose |
|---|---|---|
/api/health | GET | liveness |
/api/sites | GET | site catalogue |
/api/scan | POST | start a scan, returns a scan_id |
/api/scan/{id} | GET | poll status / final aggregate |
/api/scan/{id}/stream | GET | Server-Sent Events |
/ | GET | placeholder 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.
- Finished
Scan - Aggregate published once a scan finishes.
- Persisted
Scan - Self-contained snapshot of a completed scan. Round-trips losslessly through JSON; tests assert that.
- Scan
Handle - Live state of one scan.
- ScanId
- Identifier for a running or finished scan.
- Summary
- Verdict counts for a finished scan.
Enums§
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.