# TunnelMole: Expose your local server to the Internet in a click ## Prerequisites - Node.js installed on your system - npm (Node Package Manager) - Administrative/sudo privileges for global installations ## Step 1: Install HTTP Server ```bash # Install http-server globally npm install -g http-server # Verify installation http-server --version ``` ## Step 2: Install TunnelMole ```bash # Install tunnelmole globally npm install -g tunnelmole # Verify installation tmo --version ``` ## Step 3: Serve Local Content ### Option A: Static Content 1. Navigate to your content directory: ```bash cd /path/to/your/files ``` 2. Start the HTTP server: ```bash http-server ``` 3. Note the local port (default is 8080) You should see output like: ``` Available on: http://localhost:8080 http://192.168.1.xxx:8080 ``` ### Option B: Development Server 1. For existing applications (React, Vue, etc.): ```bash # Example for React npm run start # Usually runs on port 3000 # Example for Vite npm run dev # Usually runs on port 5173 ``` 2. Note the port number from your development server output ## Step 4: Create Tunnel ### Basic Usage ```bash # Format: tmo PORT_NUMBER tmo 8080 # For http-server # OR tmo 3000 # For React # OR tmo 5173 # For Vite ``` ### Expected Output You'll receive two URLs: ``` HTTP: http://xxx.tunnelmole.net HTTPS: https://xxx.tunnelmole.net ``` ## Step 5: Access Your Content 1. Copy either URL (HTTPS recommended) 2. Share with others or use on different devices 3. Access your local content through the provided URL ## Common Configurations ### Specific Directory Serving ```bash # Serve a specific directory http-server ./my-project -p 8000 tmo 8000 ``` ### Custom Port ```bash # Start http-server on custom port http-server -p 3333 tmo 3333 ``` ### Development Server with Hot Reload ```bash # In your React/Vue project directory npm run dev # In a new terminal tmo 5173 # or your dev server port ``` ## Troubleshooting ### Port Already in Use 1. Find the process using the port: ```bash # Windows netstat -ano | findstr :8080 # Mac/Linux lsof -i :8080 ``` 2. Stop the process or use a different port: ```bash http-server -p 8081 tmo 8081 ``` ### Connection Issues 1. Verify local server is running: ```bash curl http://localhost:8080 ``` 2. Check firewall settings 3. Ensure only one tunnel is running per session ### Tunnel Connection Failed 1. Stop any running tunnels 2. Restart the tunnel service: ```bash tmo --restart ``` ## Best Practices 1. Security: - Use HTTPS URLs when possible - Don't expose sensitive data - Close tunnels when not in use 2. Performance: - Limit tunnel usage to development/testing - Monitor bandwidth usage - Use compression when available: ```bash http-server --gzip ``` 3. File Sharing: - Create temporary directories for shared content - Remove sensitive files before serving - Set appropriate permissions: ```bash http-server --cors ``` ## Cleanup 1. Stop the tunnel: - Press `Ctrl + C` in the terminal running TunnelMole 2. Stop the HTTP server: - Press `Ctrl + C` in the terminal running the server 3. Optional - Uninstall tools: ```bash npm uninstall -g tunnelmole npm uninstall -g http-server ```