A Peer-to-Peer cross-platform clipboard syncing tool.

Overview

p2p-clipboard

p2p-clipboard is a Peer-to-Peer cross-platform clipboard syncing tool. It enables users to synchronize clipboard contents across multiple machines without the need for a centralized server.

Currently, it supports Windows, macOS, and partially Linux platforms. See the Limitation section for Linux support status.

Features

  • Peer-to-Peer clipboard syncing: Sync clipboard contents across machines seamlessly.
  • Cross-platform compatibility: Works on Windows, macOS, and partially on Linux.
  • Decentralized and flexible architecture: No need for a centralized server, and works for most network topologies.
  • Easy setup and usage: Zero config for basic usage.

Installation

GUI Wrappers:

Pre-built binaries:

Pre-built binaries for Windows(x86-64), macOS(universal) and Linux(x86-64 and arm64) are available on the release page.

macOS users need to do xattr -d com.apple.quarantine /path/to/p2p-clipboard first to run it.

Build from source:

git clone https://github.com/gnattu/p2p-clipboard.git
cd p2p-clipboard
cargo build --release

Please note: if you are using Linux, you will also need libxcb and its dev-dependencies installed.

Usage

A Peer-to-Peer clipboard syncing tool.

Usage: p2p-clipboard [OPTIONS]

Options:
  -c, --connect <IP:PORT> <PEER_ID>  The remote peer to connect to on boot up
  -k, --key <PATH>                   Path to custom private key. The key should be an ED25519 private key in PEM format
  -l, --listen <IP:PORT>             Local address to listen on
  -p, --psk <PSK>                    Pre-shared key. Only nodes with same key can connect to each other
  -n, --no-mdns                      If set, no mDNS broadcasts will be made
  -h, --help                         Print help
  -V, --version                      Print version

Short Version:

  1. Run p2p-clipboard on each machine you want to sync clipboard contents.
  2. Ensure that machines are connected to the same network.
  3. Copy text to the clipboard on one machine, and it should be synchronized with other machines automatically.

Long Version:

To synchronize the clipboard, you need at least two nodes connected to each other to form a peer-to-peer network.

p2p-clipboard offers two network bootstrapping modes:

  1. Automatic Discovery: By default, p2p-clipboard uses mDNS to automatically find peers within the same network. You just run it, and it should discover peers in the same network and start sharing clipboard.

  2. Manual Bootstrapping: For more complicated networks where mDNS cannot be used, you can manually specify a "boot node" during startup. This node serves as the initial connection point, and it can be any node already in the p2p network. You specifiy it with -c or --connect, and p2p-clipboard will find all other peers through that peer.

You can manually select which IP or port to use with -l or --listen option. If you only want to spcify IP and don't care about port number, you use 0 as the port number: -l 127.0.0.1:0. If you only want to spcify a port number and want to use all IPs, you use 0.0.0.0 as the IP address: -l 0.0.0.0:12450

Each node needs to have a unique keypair as its identifier in the p2p network. It is an ED25519 keypair and is used for encrypting traffic as well. The PeerID is the string representation of the public key of that keypair. By default, the keypair is derived from your machine ID. If you want to specify your own key, you can generate your own private key with the following command:

openssl genpkey -algorithm Ed25519 -out private_key.pem

And then use -kor --key to use it.

If not everyone in your local network is trusted by you, you can specify an extra pre-shared key to make your p2p network private. The pre-shared key can be any string and is specified with -p or --psk. Only nodes with the same pre-shared key can be peers with each other. This key won't be sent over network.

If you plan to use p2p-clipboard in a public network, you may want to use -n or --no-mdns to disable peer discovery with mDNS and manually specify a boot node.

Network Flexibility

The p2p-clipboard Network is designed to be highly flexible, allowing nodes to operate in various network configurations. Unlike many other projects, it does not require all nodes to be in the same network subnet, nor does it strictly demand direct IP access to other nodes.

In the p2p-clipboard Network, when a peer receives a new message (the clipboard content) from another peer, it stores the message and forwards a copy to all other peers it is connected. This makes it possible to ensure seamless communication between nodes, even when direct IP connections are not possible.

For example, PeerB can connect to both PeerA and PeerC. However, PeerA and PeerC do not have a direct IP connection between them. In this case, PeerB will automatically act as a forwarder, ensuring that information can still be transmitted between PeerA and PeerC.

   Peer A          Peer B          Peer C
+---------+     +---------+     +---------+
|         |     |         |     |         |
|    A    |<--->|    B    |<--->|    C    |
|         |     |         |     |         |
+---------+     +---------+     +---------+

This will be useful when some peers in your network are behind some kind of NAT, which makes other peers unable to connect to them directly. In this case, a peer behind NAT will try to establish a connection from its side to all other peers in the network. However, we may also have some other peers which are also behind NAT, making it impossible to have direct connections between them. In this case, as long as there is a forwarding path available between these two peers, they can still have the clipboard synced.

Limitation

Currently has following limitation:

  • Only supports pure text contents.
  • The max payload size over network is hardcoded to 64KB after compression at the moment, which is ~150KB raw data. This should be sufficient for most use cases, but it may be increased in the future.
  • The default zero-configuration setup is suitable only when everyone in your local network is trusted by you. While all data is encrypted with TLS, the default setting allows anyone running p2pclipboard in your local network to read your clipboard, potentially exposing sensitive information. Use a PSK if not everyone in your LAN is trusted.
  • For Linux users: Not all Wayland compositors are supported, so if your desktop environmen uses an unsupported compositor, you will need to use X11 instead. The Wayland standard protocol does not allow windowless applications like p2p-clipboard to access the user clipboard. Compositors need to implement their own protocols for such use cases. wlroots-based compositors and KDE's KWin implement the wlr_data_control protocol, but GNOME's Mutter and Wayland's own Weston do not.

License

This project is licensed under the MIT License.

You might also like...
A minimalistic cross-platform malware scanner with non-blocking realtime filesystem monitoring using YARA rules.
A minimalistic cross-platform malware scanner with non-blocking realtime filesystem monitoring using YARA rules.

Sauron is a minimalistic, YARA based malware scanner with realtime filesystem monitoring written in Rust. Features Realtime scan of created and modifi

Cross-platform atomic wait and wake (aka futex) functionality for Rust.

Cross platform atomic wait and wake (aka futex) functionality. This crate only supports functionality that's available on all of Linux, Windows, and m

A simple to use, cross-platform aes encryption

About Project End to End encryption (AES) for multiple languages (cross-platform) with CBC Icon Item 🥳 Upcoming ⚖️ License 📝 ChangeLog Usage (rust)

CLI password manager with encryption: AES256, Salsa20 and Chacha20, with cross platform and exclusive features
CLI password manager with encryption: AES256, Salsa20 and Chacha20, with cross platform and exclusive features

Keep My House (CLI) CLI password manager with encryption: AES256, Salsa20 and Chacha20, with cross platform and exclusive features Features AES256 GCM

Cross-platform user interface framework for Rust.

Viewbuilder Examples Cross-platform user interface framework for Rust. This crate provides an HTML-like render API for the backend of a UI. It's built

Cross-chain hub for Crypto Asset on Polkadot

ChainX ChainX is a community-driven project built on the next-generation blockchain framework substrate, the largest Layer-2 network of Bitcoin using

Basilisk node - cross-chain liquidity protocol built on Substrate

Basilisk node Local Development Follow these steps to prepare a local Substrate development environment 🛠️ Simple Setup Install all the required depe

Cross-chain bridge message delivery network. We are hiring, [email protected]

Introduction Implementation of a https://darwinia.network node in Rust based on the Substrate framework. This repository contains runtimes for the Dar

A simple example demonstrating cross-contract calls in CosmWasm smart contracts

Cross-contract calls This tutorial demonstrates cross-contract calls with CosmWasm v1. Overview An end user calls the reservation contract to register

Owner
Coding noob
null
NymDrive is a complete, end-to-end encrypted file syncing daemon that runs over the Nym network.

NymDrive NymDrive is a complete, end-to-end encrypted file syncing daemon that runs over the Nym network. Features Active file monitoring of changes i

Hans Bricks 16 Jul 12, 2022
Dione is an anonymize and encrypted messaging system build on top on a peer to peer layer.

Secure and Anonymous Messaging WARNING: Currently Dione is not ready to be used nor does it fulfill its goal of being an anonymous messenger. In order

Dione 41 Jan 5, 2023
Consensus layer peer-to-peer connection setup

Consensus Layer P2P This project is a basic setup for a consensus layer peer-to-peer connection, as specified in the consensus layer specifications of

Brechy 11 Dec 31, 2022
Peer-to-Peer, incentive social feed application on Linera

ResPeer: Peer-to-Peer content publishing application on Linera ResPeer on Linera ResPeer is a Peer-to-Peer content publishing application on Linera. R

null 10 Aug 17, 2023
A peer-to-peer database in Rust

rustp2p A simple yet powerful Peer-to-Peer key-value database implemented in Rust. This project also includes a CLI (Command Line Interface) that enab

Luis Soares 3 Nov 20, 2023
An infrastructure for peer-to-peer, decentralized, and collaborative software.

karyon An infrastructure for peer-to-peer, decentralized, and collaborative software. In molecular biology, a Karyon is essentially "a part of the cel

karyons 14 Dec 2, 2023
A fast, simple and powerful open-source cross platform utility tool for generating strong, unique and random passwords

password-generator-pro A fast, simple and powerful open-source cross platform utility tool for generating strong, unique and random passwords. Feature

Sebastien Rousseau 3 Dec 16, 2022
The protocol are designed and made for the future of cross-IP, cross-chain metaverse.

Avatar-protocol 化身协议 This project demonstrates how to use the Solana Javascript API to interact with programs on the Solana blockchain. The project co

Wind-protocol 1 Jan 10, 2022
Cross-platform Secure TUI Secret Locker

SafeCloset keeps your secrets in password protected files. SafeCloset is designed to be convenient and avoid common weaknesses like external editing o

Canop 63 Dec 26, 2022
DexiosGUI - Simple cross-platform drag-and-drop Dexios file encryption

DexiosGUI Simple cross-platform drag-and-drop Dexios file encryption. Latest Windows x64 release is here. DexiosGUI is a Qt/C++ app for encrypt and de

Fabrice Corraire 4 Jul 25, 2022