diff --git a/README.md b/README.md index 3692467..33daf7f 100644 --- a/README.md +++ b/README.md @@ -55,8 +55,9 @@ A sophisticated P2P coordinator manages all networking components: - Go 1.21 or later - SQLite3 - 10MB+ available storage +- Linux/macOS/Windows -### Quick Start +### Quick Start (Standalone) ```bash # Clone repository @@ -70,48 +71,222 @@ go build -o gateway ./cmd/gateway ./gateway ``` -The web interface will be available at http://localhost:9876 +The web interface will be available at http://localhost:9877 + +### Production Deployment (No Docker) + +For production deployment without Docker, use the native installation script: + +```bash +# Make installation script executable +chmod +x scripts/install_native.sh + +# Install as system service +sudo ./scripts/install_native.sh + +# Start the service +sudo systemctl start torrent-gateway +sudo systemctl enable torrent-gateway + +# Check status +sudo systemctl status torrent-gateway +``` + +### Nginx Reverse Proxy Configuration + +For production deployments, use Nginx as a reverse proxy: + +```nginx +server { + listen 80; + server_name your-domain.com; + + # Redirect HTTP to HTTPS + return 301 https://$server_name$request_uri; +} + +server { + listen 443 ssl http2; + server_name your-domain.com; + + # SSL Configuration + ssl_certificate /path/to/your/certificate.pem; + ssl_certificate_key /path/to/your/private-key.pem; + ssl_protocols TLSv1.2 TLSv1.3; + ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384; + ssl_prefer_server_ciphers off; + + # Security Headers + add_header X-Frame-Options "SAMEORIGIN" always; + add_header X-XSS-Protection "1; mode=block" always; + add_header X-Content-Type-Options "nosniff" always; + add_header Referrer-Policy "no-referrer-when-downgrade" always; + add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always; + + # Gateway API and Web Interface + location / { + proxy_pass http://127.0.0.1:9877; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # WebSocket support for real-time features + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + + # Increase timeouts for large file uploads + proxy_connect_timeout 60s; + proxy_send_timeout 60s; + proxy_read_timeout 60s; + } + + # Blossom Server (optional, if running separately) + location /blossom/ { + proxy_pass http://127.0.0.1:8082/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + # Increase client max body size for file uploads + client_max_body_size 10G; + + # Enable gzip compression + gzip on; + gzip_vary on; + gzip_min_length 1024; + gzip_proxied any; + gzip_comp_level 6; + gzip_types text/plain text/css text/xml text/javascript application/json application/javascript application/xml+rss application/atom+xml image/svg+xml; +} +``` + +### SystemD Service Configuration + +The native installer creates a systemd service. Manual configuration: + +```bash +# Create service file +sudo tee /etc/systemd/system/torrent-gateway.service > /dev/null <

⚡ BitTorrent Gateway

-

Comprehensive Unified Content Distribution System

+

Decentralized Content Distribution with Nostr Integration

What This Platform Does

-

The BitTorrent Gateway is a comprehensive unified content distribution system that seamlessly integrates BitTorrent protocol, WebSeed technology, DHT peer discovery, and Nostr announcements. It provides intelligent content distribution by automatically selecting the optimal delivery method:

+

The BitTorrent Gateway is a next-generation content distribution system that combines the reliability of traditional web hosting with the power of peer-to-peer networks and decentralized social discovery through Nostr. It automatically chooses the best way to store and distribute your files:

@@ -231,6 +231,104 @@
+ +
+

Why This Approach Works

+
+
+ 🚀 +
+ Always Available: Files are instantly accessible via WebSeed, with P2P peers providing additional bandwidth +
+
+
+ 🌐 +
+ Scales Automatically: Popular files get more peers, reducing server load naturally +
+
+
+ 🔒 +
+ Censorship Resistant: Content announced on Nostr can't be taken down by any single party +
+
+
+ 💰 +
+ Cost Effective: P2P distribution reduces bandwidth costs for large files +
+
+
+
+
+ +
+

🌟 How Nostr Integration Works

+

Nostr (Notes and Other Stuff Transmitted by Relays) is a decentralized protocol that enables censorship-resistant social networking. Here's how we integrate it for content distribution:

+ +
+
+
1
+
+
Content Upload
+

You upload a file using your Nostr identity (no email or passwords needed)

+
+
+
+
+
2
+
+
Automatic Processing
+

System creates torrents, generates magnet links, and sets up WebSeed URLs

+
+
+
+
+
3
+
+
Nostr Announcement
+

File metadata is broadcast to Nostr relays as a structured event

+
+
+
+
+
4
+
+
Social Discovery
+

Other users can discover, comment on, and share your content through Nostr clients

+
+
+
+ +
+

Benefits of Nostr Integration:

+
    +
  • No Central Control: Content discovery happens through the distributed Nostr relay network
  • +
  • Social Features: Users can comment, react, and share content using any Nostr client
  • +
  • Network Effects: Content spreads naturally through social connections
  • +
  • Privacy: You control your identity and data through cryptographic keys
  • +
  • Interoperability: Works with existing Nostr apps and clients
  • +
+
+ +
+

Example Nostr Event:

+
+
{
+  "kind": 1063,
+  "content": "New file: example-video.mp4",
+  "tags": [
+    ["magnet", "magnet:?xt=urn:btih:..."],
+    ["size", "157286400"],
+    ["name", "example-video.mp4"],
+    ["webseed", "https://gateway.example.com/api/webseed/..."],
+    ["mimetype", "video/mp4"]
+  ]
+}
+
+

This event gets distributed across Nostr relays, allowing anyone subscribed to file announcements to discover new content.

+