Zoo Node Reference
Technical reference for the Zoo discovery service
Zoo node reference
Technical reference for the Zoo service. The Zoo is OctoMY™'s global discovery and NAT traversal service.
Security Consideration
The Zoo is designed with minimal knowledge - it helps nodes find each other but never sees message contents. All actual communication is encrypted peer-to-peer. The Zoo only temporarily stores connection metadata (IP addresses, public keys) needed for hole-punching, and this data is automatically purged after 5-30 minutes.
Overview
| Property | Value |
|---|---|
| Class | ZooServer |
| NodeType | TYPE_ZOO |
| Default Port | 8123 (HTTP) |
| Theme Color | orange |
| Library | libzoo |
Architecture
The Zoo is architecturally different from other node types - it's a standalone HTTP server, not a Node subclass:
Core components
ZooServer class
class ZooServer : public qhttp::server::QHttpServer {
QSharedPointer<AppContext> mContext;
QSharedPointer<KeyStore> mKeyStore;
Identicon mIdenticon;
Hashstore mStorage;
PunchRegistry mPunches;
DiscoveryServer mDiscovery;
// ...
};
Key components
| Component | Purpose |
|---|---|
PunchRegistry |
NAT hole-punching coordination |
DiscoveryServer |
Node discovery escrow |
Hashstore |
Key-value storage |
Identicon |
Visual identity generation |
Services provided
1. UDP hole-punching
Helps nodes connect through NAT firewalls:
The Zoo never sees the actual communication content - it only helps establish the initial connection.
2. Discovery escrow
Nodes can deposit discovery information for others to find:
POST /api/discovery/escrow
{
"node_id": "abc123...",
"gps": {"lat": 37.7749, "lon": -122.4194},
"addresses": ["192.168.1.5:8124"],
"timestamp": 1705312800
}
Other nodes can query by proximity:
GET /api/discovery/nearby?lat=37.78&lon=-122.42&radius=1000
3. Identicon service
Generate visual identities from node IDs:
GET /identicon/{node_id}.png
Returns a procedurally generated icon based on the cryptographic identity.
API endpoints
Discovery API
| Endpoint | Method | Purpose |
|---|---|---|
/api/discovery/escrow |
POST | Deposit discovery info |
/api/discovery/nearby |
GET | Find nodes by GPS |
/api/discovery/lookup |
GET | Look up specific node |
Punch API
| Endpoint | Method | Purpose |
|---|---|---|
/api/punch/register |
POST | Register for hole-punching |
/api/punch/partner |
GET | Get partner's address |
Utility API
| Endpoint | Method | Purpose |
|---|---|---|
/identicon/{id}.png |
GET | Generate identicon |
/ |
GET | Status page |
/admin/ |
GET | Admin interface (restricted) |
Security design
The Zoo is designed with minimal knowledge:
What Zoo knows
| Data | Duration | Purpose |
|---|---|---|
| Node public keys | Temporary | Connection coordination |
| IP addresses | Temporary | NAT traversal |
| GPS coordinates | Temporary | Proximity discovery |
What Zoo does NOT know
- Message contents (encrypted P2P)
- Node configurations
- Trust relationships
- User identities
- Communication history
Data retention
Background timer prunes stale data:
- Punch registrations: 5 minute timeout
- Discovery escrow: 30 minute timeout
Configuration
Command line
# Start on default port (8123)
./zoo
# Start on custom port
./zoo --port 9999
# Start with admin interface enabled
./zoo --admin-path /secret-admin-path
# Enable debug output
./zoo --debug
Environment variables
| Variable | Description |
|---|---|
ZOO_PORT |
HTTP port to listen on |
ZOO_ADMIN_PATH |
URL path for admin interface |
ZOO_DATA_DIR |
Data storage directory |
Storage
Hashstore
The Zoo uses a simple key-value store:
/var/lib/octomy-zoo/
├── hashstore.db # Key-value storage
├── keystore.json # Server identity
└── logs/ # Access logs
Data schema
Punch Registration:
{
"node_id": "abc123...",
"address": "1.2.3.4:8124",
"partner_id": "def456...",
"registered": 1705312800
}
Discovery Escrow:
{
"node_id": "abc123...",
"type": "agent",
"gps": {"lat": 37.7749, "lon": -122.4194},
"addresses": ["192.168.1.5:8124", "10.0.0.1:8124"],
"timestamp": 1705312800,
"expires": 1705314600
}
Deployment
Systemd service
[Unit]
Description=OctoMY Zoo Discovery Service
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/zoo --port 8123
Restart=always
User=octomy
Group=octomy
[Install]
WantedBy=multi-user.target
Docker
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y libqt6-dev
COPY zoo /usr/local/bin/
EXPOSE 8123
CMD ["zoo", "--port", "8123"]
Cloud deployment
Monitoring
Health check
curl http://zoo.octomy.org/
# Returns: {"status": "ok", "uptime": 86400, "version": "1.0.0"}
Metrics
| Metric | Description |
|---|---|
punch_registrations |
Active hole-punch registrations |
discovery_escrows |
Active discovery entries |
requests_per_second |
API request rate |
p2p_connections_facilitated |
Successful connections |
Hardware requirements
| Component | Minimum | Recommended |
|---|---|---|
| CPU | Single-core | Dual-core |
| RAM | 256 MB | 1 GB |
| Storage | 1 GB | 10 GB |
| Network | 10 Mbps | 100 Mbps |
The Zoo is intentionally lightweight to enable easy deployment.
Client integration
Nodes use ZooClient to communicate with the Zoo:
class ZooClient : public QObject {
// Register for hole-punching
void registerForPunch(QString partnerId);
// Query discovery
void queryNearby(QGeoCoordinate location, qreal radius);
// Deposit discovery info
void depositDiscovery(QVariantMap info);
};
Client library
| Library | Class | Purpose |
|---|---|---|
libzooclient |
ZooClient |
Client API |
libzooclient |
WebRequest |
HTTP requests |
libzooclient |
PunchRegistry |
Local punch state |