This is a central part in communication process, a server that connects clients of all flavors.
It's based on Tokio and an amazing tokio-websockets
library.
It has only one endpoint: /
that:
- receives incoming TCP connections
- performs initial handshake and switches to WebSocket protocol
- performs authentication (and disconnects if it fails)
- sends the most recent clip to newly connected client
- starts receiving new clipboard texts from clients
- broadcasts them to all connected clients
Authentication is based on a static token that is written in the config.toml
.
The server itself doesn't handle any TLS, instead it expects a reverse proxy in front of it (Nginx/caddy/etc).
cargo build --release
Additionally, there's a debian/mpclipboard-server.service
systemd service if you need it.
We provide a Docker image on ghcr.io (GitHub container registry).
First, you need a config.toml
file:
host = "0.0.0.0"
port = 3000
token = "s3cr3t"
Then:
- optionally enable logging
- specify port mapping
- mount volume with a config
docker run \
-e RUST_LOG=trace
-p 3000:3000 \
-v ./config.toml:/etc/mpclipboard-server/config.toml:ro \
ghcr.io/mpclipboard/server:latest