Skip to content
虚拟世界的懒猫 edited this page Feb 26, 2026 · 7 revisions

English | 中文

A high-performance, multi-path file search HTTP server built with Rust.

🚀 What is FileHunter?

FileHunter is a lightweight HTTP server that routes incoming requests by URL prefix to configurable groups of search directories, serves the first matching file via chunked streaming, and returns 404 if nothing is found. It is designed for scenarios where files are distributed across multiple storage paths and need to be served efficiently through a single HTTP endpoint.

Core Features

  • Multi-prefix URL routing — longest-prefix-match dispatches requests to different directory groups
  • Per-path extension filtering — restrict each search path to specific file types (e.g., jpg, png)
  • Three search modessequential, concurrent, and latest_modified to fit different access patterns
  • Async streaming — built on tokio + hyper 1.x with ReaderStream chunked transfer
  • HTTP/1.1 & HTTP/2 auto negotiation — seamless protocol support via hyper-util
  • Security hardened — path traversal protection, dotfile blocking, null byte rejection, symlink escape prevention
  • CORS support — configurable cross-origin resource sharing with fine-grained origin, method, and header control
  • Per-IP rate limiting — GCRA-based rate limiter with configurable burst size and automatic cleanup
  • Basic Authentication — optional global HTTP Basic Auth with constant-time password comparison; health endpoints exempt
  • Response compression — optional gzip, deflate, Brotli, and zstd compression with configurable algorithms and minimum size threshold
  • Human-friendly TOML config — sizes like "10MB", intuitive [[locations]] array syntax
  • Tiny binary — ~3 MB with LTO + strip enabled

⚡ Quick Start

From Source

cargo build --release ./target/release/filehunter --config config.toml

Docker

docker compose up -d

Minimal Config

[server] bind = "0.0.0.0:8080" [[locations]] prefix = "/" [[locations.paths]] root = "/data/files"

📚 Documentation

Page Description
Architecture Layered architecture diagram and design decisions
Configuration Reference Complete field reference with types and defaults
Configuration Examples 11 real-world TOML configuration scenarios
Search Modes Deep dive into sequential, concurrent, latest_modified
Routing URL prefix matching, path stripping, segment boundaries
Deployment Docker, Docker Compose, Nginx, systemd
Security Path traversal protection, dotfile blocking, size limits
Testing Test suite overview: 73 unit + 33 integration tests

Clone this wiki locally