Minimal Tor search engine scaffold in Go with an AI-assisted crawler.
- Tor SOCKS5 fetcher (
127.0.0.1:9050by default) - Onion version detection and separation:
v2:16 chars + .onionv3:56 chars + .onion
- Separate crawl queues for v2/v3 with independent worker and page limits
- HTML parsing, onion link discovery, and crawl frontier dedupe
- In-memory full-text index split by onion version
- Heuristic AI enrichment (summary, tags, quality score)
- HTTP API:
GET /healthGET /statsGET /search?q=...&version=v2|v3&limit=20
Tor v2 onion services were deprecated and disabled in modern Tor around October 2021. This crawler can classify and queue v2 links, but successful fetching usually requires legacy-compatible environments.
- Start Tor locally (SOCKS5 at
127.0.0.1:9050). - Either set explicit seeds or configure seed source pages.
- Run:
$env:TORSEARCH_SEEDS="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.onion"
go run ./cmd/torsearchIf TORSEARCH_SEEDS is empty, startup can fetch configured source pages and extract .onion URLs:
$env:TORSEARCH_SEED_SOURCES="https://your-search-page-1.example/?q=onion,https://your-search-page-2.example/onions"
$env:TORSEARCH_SEED_SOURCE_LIMIT="200"
go run ./cmd/torsearchThe discovered results are normalized to host-level seeds like http://<onion-host>/.
- Copy
.env.exampleto.env. - Set at least one of
TORSEARCH_SEEDSorTORSEARCH_SEED_SOURCESin.env. - Start the stack:
docker compose up -d --build- Check status:
docker compose ps
curl http://127.0.0.1:8080/health
curl http://127.0.0.1:8080/statsIf port 8080 is already in use, set TORSEARCH_HOST_PORT in .env (for example 18080) and query that port instead.
- Stop:
docker compose downSet at least one of TORSEARCH_SEEDS or TORSEARCH_SEED_SOURCES.
TORSEARCH_SEEDS(optional): comma-separated onion seedsTORSEARCH_SEED_SOURCES(optional): comma-separated pages to scrape for onion seeds whenTORSEARCH_SEEDSis emptyTORSEARCH_SEED_SOURCE_LIMIT(default200): maximum seeds discovered at startupTORSEARCH_HOST_PORT(default8080): host port mapped to container port8080TORSEARCH_HTTP_BIND(default:8080)TORSEARCH_TOR_SOCKS(default127.0.0.1:9050)TORSEARCH_USER_AGENT(defaulttorsearch-crawler/0.1)TORSEARCH_REQUEST_TIMEOUT(default30s)TORSEARCH_MAX_BODY_BYTES(default2097152)TORSEARCH_WORKERS_V2(default1)TORSEARCH_WORKERS_V3(default4)TORSEARCH_MAX_PAGES_V2(default0)TORSEARCH_MAX_PAGES_V3(default1000)TORSEARCH_MAX_DEPTH(default2)TORSEARCH_RETRY_LIMIT(default2)TORSEARCH_RETRY_BACKOFF(default3s)TORSEARCH_IDLE_SLEEP(default350ms)
- Persist crawl state/frontier in PostgreSQL or Redis
- Replace in-memory index with OpenSearch/Meilisearch
- Add robust duplicate detection and content safety controls
- Add distributed workers and observability