How purplei2p/i2pd-tools works
Project Type and Purpose
• This is an open-source toolkit (i2pd-tools) comprised of multiple command-line utilities that extend the functionality of an existing I2P router implementation (i2pd).
• Each tool (keygen, keyinfo, routerinfo, regaddr, vain, famtool, AutoConf, etc.) offers a specialized function—from key generation and inspection, vanity address generation, address registration, to configuration file generation.
File Structure Analysis
• Top-Level Executables (each .cpp in the root):
• autoconf.cpp
• b33address.cpp
• famtool.cpp
• i2pbase64.cpp
• keygen.cpp
• keyinfo.cpp
• offlinekeys.cpp
• regaddr.cpp / regaddr_3ld.cpp / regaddralias.cpp
• routerinfo.cpp
• verifyhost.cpp
• x25519.cpp
• Shared Code
• common/key.hpp – shared data structures and helper functions (e.g., key parsing, encoding)
• Submodule
• i2pd/ – embedded clone of the i2pd codebase for direct access to its internal types and I2P wire formats
• Scripts & Build
• scripts/i2pdctl – helper script to control a running i2pd instance
• dependencies.sh – installs system‐level prerequisites (Boost, OpenSSL, zlib)
• Makefile – orchestrates compilation of all tools against Boost, OpenSSL, zlib, and the i2pd submodule
Key Architectural Components
a. CLI Tools Layer
• Them visually under a “Tools” section.
b. Shared Library Layer
• A common helper library (code under common/) providing crypto utilities, encoding/decoding, and command‐line argument parsing support.
c. I2P Core Integration
• The embedded i2pd submodule: used by tools that must parse or generate I2P-specific data structures (routerInfo, LeaseSet, destination keys).
d. External Dependencies
• Boost libraries (chrono, filesystem, program-options, date-time)
• OpenSSL (crypto APIs)
• zlib (compression)
e. External Services
• HTTP endpoints at reg.i2p and stats.i2p (used by regaddr tools to submit authentication strings)
f. Scripts & Build System
• dependencies.sh (left side, provisioning)
• Makefile (central orchestrator)
• scripts/i2pdctl (runtime control)
Interactions and Data Flows
• User → (invokes) → CLI Tool
• CLI Tool → (links against) → Shared Library & i2pd Submodule & System Dependencies
• CLI Tool → (reads/writes) → Files on Disk (.dat key files, routerInfo blobs, config files)
• regaddr / regaddr_3ld / regaddralias → (POST auth_string) → External HTTP Service (reg.i2p / stats.i2p)
• famtool → (calls) → i2pd submodule APIs to sign or verify router.info
• AutoConf → (generates) → i2pd config file
Architectural Patterns & Principles
• Modular CLI architecture: each command is its own binary
• Shared common library to avoid code duplication
• Embedded submodule for tight coupling to I2P core types/formats
• Standard Makefile build with dependency provisioning script
• Clear separation of concerns: cryptographic operations vs. I/O vs. network interactions