docs.rs failed to build moosicbox_tunnel_server-0.2.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
moosicbox_tunnel_server-0.1.1
MoosicBox Tunnel Server
Basic WebSocket-based tunneling server for MoosicBox remote access.
Overview
The MoosicBox Tunnel Server provides:
- WebSocket Tunneling: Basic tunneling through WebSocket connections
- Client Registration: Simple client authentication and registration
- Database Integration: PostgreSQL backend for client management
- HTTP API: REST endpoints for tunnel management
- Health Monitoring: Basic health check endpoint
Features
Core Functionality
- WebSocket Server: Handles WebSocket connections for tunneling
- Authentication: Basic client registration and token-based auth
- Database Storage: Client data stored in PostgreSQL
- HTTP Endpoints: REST API for tunnel operations
- CORS Support: Cross-origin resource sharing enabled
Available Endpoints
- Health Check:
/healthendpoint for service monitoring - WebSocket:
/wsendpoint for tunnel connections - Client Registration: Authentication and client management
- Magic Token Auth:
/auth/magic-tokenand/auth/validate-signature-token - Track/Album/Artist: Media proxy endpoints
- Tunnel Management: Basic tunnel lifecycle operations
Installation
From Source
# Install dependencies
# Clone and build
TUNNEL_ACCESS_TOKEN=your-secure-token
# Install binary
Database Setup
# Install and setup PostgreSQL
# Create database and user
Usage
Running the Tunnel Server
# Start tunnel server on default port 8000
# Start on custom port
# With environment variables
Environment Variables
Build-Time Variables
TUNNEL_ACCESS_TOKEN: Required access token for general authorization (must be set during compilation)
Runtime Variables
PORT: Server port (default: 8000)BIND_ADDR: Bind address (default: 0.0.0.0)DATABASE_URL: PostgreSQL connection stringMAX_THREADS: Maximum blocking threads (default: 64)ACTIX_WORKERS: Number of Actix workers
API Reference
Health Check
WebSocket Connection
const ws = ;
ws console.log;
ws console.log;
Client Authentication
# Register client (requires TUNNEL_ACCESS_TOKEN in Authorization header)
# Get signature token (requires client access token in Authorization header)
# Validate a signature token
# Register a magic token for a client (requires client access token)
# Use a magic token
Tunnel Proxy Request
# Proxy an HTTP request through the tunnel (requires client access token)
Configuration
The server can be configured via environment variables:
# Basic configuration
# Performance tuning
# Logging
# For tokio console debugging
Development
Building
# Build with all features
TUNNEL_ACCESS_TOKEN=your-secure-token
# Build with specific features
TUNNEL_ACCESS_TOKEN=your-secure-token
Running in Development
# Run with debug logging
TUNNEL_ACCESS_TOKEN=your-secure-token RUST_LOG=debug
# Run with tokio console
TUNNEL_ACCESS_TOKEN=your-secure-token TOKIO_CONSOLE=1
Implementation Notes
- The server is built with Actix Web framework
- Uses PostgreSQL for data persistence
- WebSocket connections are managed through a dedicated service
- CORS is configured for web client access
- Supports graceful shutdown with proper cleanup
- Includes basic telemetry and metrics collection