Expand description
Local HTTP server for serving EVM profiles to speedscope.app.
This module implements a temporary local HTTP server that:
- Serves the profile JSON at
/{token}/profile.json - Sets CORS headers to allow the viewer to fetch it
- Constructs the proper URL and opens it in the browser
Re-exportsยง
use axum::Router;๐use axum::body::Bytes;๐use axum::extract::State;๐use axum::http::Method;๐use axum::http::StatusCode;๐use axum::http::header;๐use axum::response::IntoResponse;๐use axum::response::Response;๐use axum::routing::get;๐use eyre::Result;๐use foundry_common::sh_err;๐use foundry_common::sh_println;๐use std::hash::DefaultHasher;๐use std::hash::Hasher;๐use std::time::SystemTime;๐use std::time::UNIX_EPOCH;๐use tokio::net::TcpListener;๐use tower_http::cors::Any;๐use tower_http::cors::CorsLayer;๐
Functionsยง
- generate_
token ๐ - Generates a random token for the URL path (32 hex characters).
- percent_
encode ๐ - Percent-encode a URL for embedding in viewer URL parameters.
- serve_
and_ open - Serves a profile on a local HTTP server and opens it in the browser.
- serve_
profile ๐