- Notifications
You must be signed in to change notification settings - Fork58
📦 Command line peer-to-peer data transfer tool based on libp2p.
License
dennis-tra/pcp
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Command line peer-to-peer data transfer tool based onlibp2p.
This tool was published at theIFIP 2021 conference. You can find the preprintbelow.
- Motivation
- Project Status
- How does it work?
- Usage
- Install
- Development
- Feature Roadmap
- Related Efforts
- Maintainers
- Acknowledgments
- Research
- License
There already exists a long list of file transfer tools (seeRelated Efforts), so why botherbuilding another one? The problem I had with the existing tools is that they rely onalimited set ofserversto orchestrate peer matching and data relaying which poses a centralisation concern. Many of the usual centralisationvs. decentralisation arguments apply here, e.g. the servers are single points of failures, the service operator has thepower over whom to serve and whom not, etc. Further, asthisrecent issue in croc shows, this is a real risk for sustainableoperation of the provided service.
The tool is in a very early stage, and I'm aware of performance, usability andsecurity issues. Don't use it for anything serious.Although I criticised tools likemagic-wormhole
orcroc
above, they are amazing and way more mature.
There are also drawbacks with this approach: It's slower than established centralised methods ifyou want to transmit data across network boundaries. A DHT query to find your peer can easily take several minutes.Further, the bandwidth and geographic location of a potential relaying peer is not guaranteed which can lead to long transmission times.
When runningpcp send
you'll see four random words from a list of the Bitcoin improvement proposalBIP39.There are lists in nine different languages of 2048 words each, currently onlyenglish
is supported.The first word is interpreted as a channel ID in the range from 0 to 2047.pcp
advertises the identifier/pcp/{unix-timestamp}/{channel-id}
in its local network viamDNS and a hashed version of this string in theDHT ofIPFS.The unix timestamp is the current time truncated to 5 minutes and the prefix/pcp
is the protocol prefix.In the future: When you enter a new 5-minute interval whilepcp send
is running it advertises an updated identifier.
To receive the file your peer enterspcp receive four-words-from-above
andpcp
uses the first word together with the current time truncated to 5 minutes to find the sending peer in theDHT and in your local network viamDNS.It also searches for an identifier of the previous 5-minute interval.As soon as the peer is found, both do a password authenticated key exchange (PAKE) to authenticate each other.In this procedure a comparably weak password (four-words-from-above
) gets replaced with a strong session key that is used to encrypt all future communication.The defaultTLS encryption thatlibp2p provides is not sufficient in this case as we could still, in theory, talk to a wrong peer - just encrypted.
After the peer is authenticated the receiver must confirm the file transfer, and the file gets transmitted.
The sending peer runs:
$ pcp send my_fileCode is: bubble-enemy-result-increaseOn the other machine run:pcp receive bubble-enemy-result-increase
The receiving peer runs:
$ pcp receive bubble-enemy-result-increaseLookingfor peer bubble-enemy-result-increase...
If you're on different networks the lookup can take quite long (~ 2-3 minutes). Currently, there is no output while both parties are working on peer discovery, so just be very patient.
brew install pcp
It's on the roadmap to also distributepcp
viaapt
,yum
,scoop
and more ...
Head over to thereleases and download the latest archive foryour platform.
To compile it yourself run:
go install github.com/dennis-tra/pcp/cmd/pcp@latest# Go 1.13 or higher is required
Make sure the$GOPATH/bin
is in yourPATH
variable to access the installedpcp
executable.
First install the protoc compiler:
make tools# downloads gofumpt and protocmake proto# generates protobuf
The current proto definitions were generated withlibprotoc 3.14.0
.
Shamelessly copied fromcroc
:
- allows any two computers to transfer data (using a relay)
- provides end-to-end encryption (using PAKE)
- ✅ yup, it uses
pake/v2
fromcroc
- ✅ yup, it uses
- enables easy cross-platform transfers (Windows, Linux, Mac)
- ✅ Linux <-> Mac, ❌ Windows, but it's planned!
- allows multiple file transfers
- ✅ it allows transferring directories
- allows resuming transfers that are interrupted
- ❌ not yet
- local server or port-forwarding not needed
- ✅ thanks toAutoNat
- ipv6-first with ipv4 fallback
- ✅ thanks tolibp2p
- can use proxy, like tor
- ❌ not yet
You can find a project plan in theproject tab of this page.Some other ideas I would love to work on include:
- browser interop via the means ofjs-libp2p
- experimental decentralised NAT hole punching via DHT signaling servers -Project Flare
croc
- Easily and securely send things from one computer to anothermagic-wormhole
- get things from one computer to another, safelydcp
- Remote file copy, powered by the Dat protocol.iwant
- CLI based decentralized peer to peer file sharingp2pcopy
- Small command line application to do p2p file copy behind firewallswithout a central server.zget
- Filename based peer to peer file transfersharedrop
- Easy P2P file transfer powered by WebRTC - inspired by AppleAirDropfilepizza
- Peer-to-peer file transfers in your browsertoss
- Dead simple LAN file transfers from the command line- Forgot yours?Open an issue or submit a PR :)
go-libp2p
- The Go implementation of the libp2p Networking Stack.pake/v2
- PAKE library for generating a strong secret between parties over an insecure channelprogressbar
- A really basic thread-safe progress bar for Golang applications
Feel free to dive in!Open an issue or submit PRs.
This tool was submitted to theInternational Federation for Information Processing 2021 (IFIP '21) conference and accepted for publication. You can find the preprinthere.
@inproceedings{Trautwein2021,title ={Introducing Peer Copy - A Fully Decentralized Peer-to-Peer File Transfer Tool},author ={Trautwein, Dennis and Schubotz, Moritz and Gipp, Bela},year =2021,month ={June},booktitle ={2021 IFIP Networking Conference (IFIP Networking)},publisher ={IEEE},address ={Espoo and Helsinki, Finland},doi ={10.23919/IFIPNetworking52078.2021.9472842},note ={ISBN 978-3-9031-7639-3},topic ={misc}}
It would really make my day if you supported this project throughBuy Me A Coffee.
You may be interested in one of my other projects:
image-stego
- A novel way to image manipulation detection. Steganography-based image integrity - Merkle tree nodes embedded into image chunks so that each chunk's integrity can be verified on its own.nebula-crawler
- A libp2p DHT crawler that also monitors the liveness and availability of peers. 🏆 Winner of theDI2F Workshop Hackathon 🏆
Apache License Version 2.0 © Dennis Trautwein
About
📦 Command line peer-to-peer data transfer tool based on libp2p.