Relay Servers
Fybrk uses relay servers as a fallback when direct P2P connections fail. This ensures your files sync reliably over the internet, even through corporate firewalls and complex NAT setups.
How It Works
- Try Direct First: Fybrk attempts direct P2P connections on local networks
- Fallback to Relay: If direct connection fails, relay servers forward messages
- Encrypted Messages: Relay servers only see encrypted data, never your files
- User Configurable: Use default relays or host your own
Default Configuration
Fybrk comes with default relay servers:
r1.fybrk.com (Primary)
r2.fybrk.com (Backup)
View your current config:
Custom Relay Servers
Option 1: Edit Config File
Edit ~/.fybrk/config.json:
1
2
3
4
5
6
7
8
|
{
"relay_servers": [
"wss://my-relay.example.com:443",
"wss://backup-relay.example.com:443"
],
"device_id": "your-device-id",
"enable_relay": true
}
|
Option 2: Environment Variable
1
2
|
export FYBRK_RELAY_SERVERS="wss://my-relay.com:443,wss://backup.com:443"
fybrk .
|
Deploy Your Own Relay
Quick Deploy with Docker
1
2
3
4
5
6
|
# Clone the relay server
git clone https://github.com/Fybrk/relay.git
cd relay
# Deploy with Docker
./deploy.sh
|
Manual Deployment
1
2
3
4
5
6
7
|
# Build and run
go build -o relay main.go
./relay
# Or with Docker
docker build -t fybrk-relay .
docker run -p 80:8080 fybrk-relay
|
Cloud Deployment Options
| Provider |
Cost/Month |
Setup |
| Hetzner Cloud |
€3.29 |
hcloud server create --type cx11 |
| DigitalOcean |
$4.00 |
Droplet + Docker |
| Fly.io |
$1.94 |
fly launch |
| Oracle Cloud |
FREE |
Always free tier |
Relay Server Requirements
- Minimal: 256MB RAM, 1 vCPU
- Bandwidth: ~1KB per message relayed
- Ports: Single port (default 8080)
- SSL: Recommended for production
Security
- No File Access: Relay servers never see decrypted files
- Message Forwarding: Only forwards encrypted messages between devices
- No Storage: Messages are not stored, only forwarded
- Open Source: Full transparency in relay server code
Monitoring
Health check endpoint:
1
2
|
curl http://your-relay-server/health
# Response: OK
|
Troubleshooting
Connection Issues
1
2
3
4
5
|
# Test relay connectivity
curl -I http://your-relay-server/health
# Check WebSocket connection
wscat -c ws://your-relay-server/relay
|
Config Problems
1
2
3
|
# Reset to defaults
rm ~/.fybrk/config.json
fybrk config # Recreates default config
|
Logs
1
2
3
4
5
|
# Relay server logs
docker logs fybrk-relay
# Fybrk client logs
fybrk . --verbose
|
Advanced Configuration
Load Balancing
Use multiple relay servers for redundancy:
1
2
3
4
5
6
7
|
{
"relay_servers": [
"wss://relay1.example.com:443",
"wss://relay2.example.com:443",
"wss://relay3.example.com:443"
]
}
|
Custom Ports
1
2
3
|
{
"relay_servers": ["wss://relay.example.com:8443"]
}
|
Disable Relay
1
2
3
|
{
"enable_relay": false
}
|
FAQ
Q: Do relay servers see my files?
A: No, they only forward encrypted messages between your devices.
Q: Can I use Fybrk without relay servers?
A: Yes, set "enable_relay": false in config. Works on local networks only.
Q: How much does hosting cost?
A: ~$3-5/month for a small server that handles thousands of devices.
Q: Is the relay server code open source?
A: Yes, available at github.com/Fybrk/relay