shared clipboard - a libp2p hello world example

Motivation

This post was motivated by the following factors:

  1. Copy and paste limitations while using a Virtual Desktop Infrastructure (VDI).

    • Copying and pasting works only from my desktop to the VDI, but not the other way around—it simply doesn’t work.
  2. Personal interest in P2P networks and distributed systems.

Solution Overview

The solution is quite simple and consists of three parts:

  1. A relay node that is publicly available on the internet.
  2. A master node that is reachable through the relay.
  3. Nodes/machines willing to share their clipboard.

How Do These Pieces Fit Together?

  • The master node connects to the relay, requests a reservation, and establishes a connection.
  • Once connected, the master receives a multiaddress containing all the necessary information for other nodes to reach it over the internet.
  • The master keeps track of all connected machines and broadcasts any new clipboard content received by a machine to all other nodes.

Summary

To summarize, it works like a chat room where all members send data only to the master, which then broadcasts it to all connected nodes.

Code Snippets

The code available at:

[] https://libp2p.io/