Live data from Hacker News

Magic Wormhole: get things from one computer to another, safely

github.com

81–90 of 262 posts

Re: Magic Wormhole: get things from one computer to another, safely

#81

author here.. happy to answer any questions!

Why is this better than rsycn or scp?

scp/rsync are great tools, but they require pre-coordination of keys. One side is the client, the other is the server. The client needs an account on the server machine (so the human on the client machine must provide an ssh pubkey to the human on the server machine, who must be root, and create a new account with `adduser`, and populate the ~/.ssh/authorized_keys file). And the client needs to know the server's correct hostkey to avoid server-impersonation attacks (so the human on the server machine must provide an ssh host pubkey to the human on the client machine, who puts it in their ~/.ssh/known_hosts file).

Once that's established, and assuming that the two machines can reach each other (the server isn't behind a NAT box), then the client can `scp` and `rsync` all they want.

Magic-wormhole doesn't require that coordination phase. The human sending the file runs `wormhole send FILENAME` and the tool prints a code. The human receiving the file runs `wormhole rx CODE`. The two programs handle the rest. You don't need a new account on the receiving machine. The CODE is much much shorter than the two pubkeys that an SSH client/server pair require, short enough that you can yell it across the room, just a number and two words, like "4-purple-sausages". And you only need to send the code in one direction, not both.

Currently, the wormhole programs don't remember anything about the connection they just established: it's one-shot, ephemeral. So if you want to send a second file later, you have to repeat the tell-your-friend-a-code dance (with a new code). We have plans to leverage the first connection into making subsequent ones easier to establish, but no code yet.

Incidentally, `wormhole ssh` is a subcommand to set up the ~/.ssh/authorized_keys file from a wormhole code, which might help get the best of both worlds, at least for repeated transfers.

Re: Magic Wormhole: get things from one computer to another, safely

#82
post #34

Earlier quoted context omitted.

syncthing and Magic Wormhole have different goals. Wormhole is very simple: it is a way (often the best way) to get a file from point A to point B, regardless of the connectivity (or lack thereof) between A and B, without accounts or configuration.

Syncthing also does relaying like that, NAT traversal, bridges, etc. all automatically. If it can, it will use local IP connections and go blazing fast. If for some reason your network configuration(s) don't allow for any valid connections, it will use a relay or bridge - either a default or one you setup - and work relatively fast as well.

"Connectivity" here needs to be taken at large: syncthing needs to have a folder already shared between two machines. There's some setup involved that is not automatic.

The entire setup phase of magic wormhole is "copy those 3 words" and boom you're done.

Re: Magic Wormhole: get things from one computer to another, safely

#83
post #59

Earlier quoted context omitted.

> move to a slower-but-flat-rate provider As I'm sure you're aware: https://www.scaleway.com/en/stardust-instances/ "up to 100Mbps" for $4/month

32.4 TB for $4, or approximately 700 times cheaper than AWS. Neat.

Bare metal love

Re: Magic Wormhole: get things from one computer to another, safely

#85
post #12

There are a few others p2pcopy https://github.com/psantosl/p2pcopy pcp https://github.com/dennis-tra/pcp wormhole-william https://github.com/psanford/wormhole-william

And more https://github.com/mat-sz/filedrop https://github.com/saljam/webwormhole https://github.com/schollz/croc https://github.com/dutchcoders/transfer.sh https://github.com/timvisee/send https://github.com/schlagmichdoch/pairdrop https://github.com/SnapDrop/snapdrop

I have a list of now 22 browser based p2p sharing tools that i shared here a few times in similar threads https://gist.github.com/SMUsamaShah/fd6e275e44009b72f64d0570...

Re: Magic Wormhole: get things from one computer to another, safely

#87
post #35
post #23

Earlier quoted context omitted.

10 different tools? Ridiculous! We need to develop one universal tool that covers everyone's use cases.

And then we'll have 11.

That would further increase the need for a single standard.

Re: Magic Wormhole: get things from one computer to another, safely

#88

Earlier quoted context omitted.

(magic-wormhole author here) Thanks for making a donation! I run the relay server, but the Debian maintainer agreed to bake an alternate hostname into the packaged versions (a CNAME for the same address that the upstream git code uses), so we could change it easily if the cost ever got to be a burden. It hasn't been a problem so far, it moves 10-15 TB per month, but shares a bandwidth pool with other servers I'm rent…

I remember at one point reading about webrtc and some kind of "introducer" server that would start the peer-to-peer connections between clients. Does wormhole try something like that before acting as a relay?

Not yet. The "Dilation" protocol (which is about 80% implemented) is intended to support WebRTC as a transport layer. IIRC it requires a public server to tell you about your external IP address, but magic-wormhole already has a server that could play that role. Once a side learns its own address, it can send it to the peer (via the encrypted tunnel, through the relay server), and then the WebRTC hole-punching protocol tries to make connections to the peer's public address. When both sides do the same thing at the same time, sometimes you can get a direct connection through the NAT boxes.

We don't have that yet, but the two sides attempt direct connections first (to all the private addresses they can find, which will include a public address if they aren't behind NAT). They both wait a couple of seconds before trying the relay, and the first successful negotiation wins, so in most cases it will use a direct connection if at all possible.

Re: Magic Wormhole: get things from one computer to another, safely

#89

I've used this for years when passing large files between systems in weird network environments, it's almost always flawless. For some more exotic testing, I was able to run my own magic wormhole relay[1], which let me tweak some things for faster/more reliable huge file copies. I still hate how often Google Drive will fall over when you throw a 10s-of-GB file at it. [1] https://www.jeffgeerling.com/blog/2023/my-own-…

I just read this out in your voice
Post reply on HN