News for hackers. Stuff that matters.
Re:Magic Wormhole: get things from one computer to another, ... by geerlingguy on Saturday August 17, 2024 @02:23PM (#41276702)
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-magic-wormhole...

Re:Magic Wormhole: get things from one computer to another, ... by cl3misch on Saturday August 17, 2024 @03:23PM (#41277198)
> you need a machine that can handle whatever link speeds you need

I would have expected the relay server only being used for initial handshake to punch through NAT, after which the transfer is P2P. Only in the case of some network restrictions the data really flows through the relay. How could they afford running the free relay otherwise?

Re:Magic Wormhole: get things from one computer to another, ... by lotharrr on Saturday August 17, 2024 @03:30PM (#41277253)
There are two servers. The "mailbox server" helps with handshakes and metadata transfers, and is super-low bandwidth, a few hundred bytes per connection. The "transit relay helper" is the one that handles the bulk data transfer iff the two sides were unable to establish a direct connection.

I've been meaning to find the time to add NAT-hole-punching for years, but haven't managed it yet. We'd use the mailbox server messages to help the two sides learn about the IP addresses to use. That would increase the percentage of transfers that avoid the relay, but the last I read, something like 20% of peer-pairs would still need the relay, because their NATs are too restrictive.

The relay usage hasn't been expensive enough to worry about, but if it gets more popular, that might change.

Re:Magic Wormhole: get things from one computer to another, ... by bscphil on Saturday August 17, 2024 @04:37PM (#41277764)
The folks on the wormhole-rs fork (who appear to share your Github organization? [1]) already have NAT punching working 95+% of the time in my testing, so maybe what they're doing could be ported over to the Python implementation.

[1] https://github.com/magic-wormhole

Re:Magic Wormhole: get things from one computer to another, ... by Fnoord on Sunday August 18, 2024 @08:46AM (#41282062)
The Rust implementation on Tailscale worked well for me. Except on a layer 7 firewall have to be quick to permit the connection or else it tries fallback.
Re:Magic Wormhole: get things from one computer to another, ... by meejah on Monday August 26, 2024 @12:14PM (#41358694)
That is just using normal STUN/TURN via another server that one of those developers is running
Re:Magic Wormhole: get things from one computer to another, ... by from-nibly on Saturday August 17, 2024 @04:45PM (#41277819)
You cant make a p2p connection over a NAT without exposing a port on the public side of the NAT.
Re:Magic Wormhole: get things from one computer to another, ... by kccqzy on Saturday August 17, 2024 @06:31PM (#41278549)
Go check out STUN and ICE.

The best article I've found about NAT traversal is this article from Tailscale: https://tailscale.com/blog/how-nat-traversal-works

Re:Magic Wormhole: get things from one computer to another, ... by jvansc on Sunday August 18, 2024 @01:36AM (#41280333)
Re:Magic Wormhole: get things from one computer to another, ... by yownie on Sunday August 18, 2024 @01:55AM (#41280397)
is there a filesize limit for this?
Re:Magic Wormhole: get things from one computer to another, ... by kccqzy on Sunday August 18, 2024 @12:39PM (#41283384)
That uses WebRTC, which uses the same NAT traversal tricks.
Re:Magic Wormhole: get things from one computer to another, ... by Fnoord on Sunday August 18, 2024 @08:51AM (#41282082)
Not bad, though you don't even need STUN or ICE;

https://github.com/samyk/pwnat

https://github.com/samyk/slipstream

Re:Magic Wormhole: get things from one computer to another, ... by t0mas88 on Saturday August 17, 2024 @04:54PM (#41277878)
Re:Magic Wormhole: get things from one computer to another, ... by voxic11 on Saturday August 17, 2024 @06:36PM (#41278577)
You aren't guaranteed to be able to do that but in practice most times you can.
Re:Magic Wormhole: get things from one computer to another, ... by dangoodmanUT on Saturday August 17, 2024 @04:25PM (#41277682)
I just read this out in your voice
Re:Magic Wormhole: get things from one computer to another, ... by geerlingguy on Sunday August 18, 2024 @04:12PM (#41285073)
Heh and I was able to do some of that work in service of the dumb but fun test of Internet vs Pigeon data transfer speeds.
Re:Magic Wormhole: get things from one computer to another, ... by bscphil on Saturday August 17, 2024 @04:28PM (#41277698)
> 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.

The lack of improvement in these tools is pretty devastating. There was a flurry of activity around PAKEs like 6 years ago now, but we're still missing:

* reliable hole punching so you don't need a slow relay server

* multiple simultaneous TCP streams (or a carefully designed UDP protocol) to get large amounts of data through long fat pipes quickly

Last time I tried using a Wormhole to transmit a large amount of data, I was limited to 20 MB/sec thanks to the bandwidth-delay product. I ended up using plain old http, with aria2c and multiple streams I maxed out a 1 Gbps line.

IMO there's no reason why PAKE tools shouldn't have completely displaced over-complicated stuff like Globus (proprietary) for long distance transfer of huge data, but here we are stuck in the past.

Re:Magic Wormhole: get things from one computer to another, ... by croemer on Saturday August 17, 2024 @08:19PM (#41279150)
20MB/sec is 160Mbps, so wormhole wasn't that far off the 1Gbps. Sure not maxing out but within a factor of 6.
Re:Magic Wormhole: get things from one computer to another, ... by dgoldstein0 on Saturday August 17, 2024 @11:21PM (#41279911)
^ found the astronomer
Re:Magic Wormhole: get things from one computer to another, ... by anonymousiam on Sunday August 18, 2024 @02:23AM (#41280526)
I (Electrical + Software Engineer) once worked for a physicist who believed that anything less than an order of magnitude was merely an engineering problem. He was usually correct.
Re:Magic Wormhole: get things from one computer to another, ... by vasco on Sunday August 18, 2024 @02:35AM (#41280572)
I was taught the same. To not care a lot about things under an order of magnitude. Over the years when planning large software projects or assessing incidents and so on, the 1 order of magnitude threshold helped me often.
Re:Magic Wormhole: get things from one computer to another, ... by croemer on Sunday August 18, 2024 @04:57AM (#41281098)
Bingo, I studied Physics!
Re:Magic Wormhole: get things from one computer to another, ... by elashri on Sunday August 18, 2024 @06:31AM (#41281479)
As a physicist, I think this is correct too :). You don't start to see problems with things under that, unless they are deviation from standard model predictions.
Re:Magic Wormhole: get things from one computer to another, ... by sva_ on Sunday August 18, 2024 @10:31AM (#41282602)
Variance in accuracy of this statement also safely within one order of magnitude
Re:Magic Wormhole: get things from one computer to another, ... by bscphil on Sunday August 18, 2024 @04:34PM (#41285264)
An order of magnitude isn't a defined quantity, it depends on what base you're working in.
Re:Magic Wormhole: get things from one computer to another, ... by newaccount74 on Monday August 19, 2024 @01:03PM (#41292709)
The difference between log 2, ln, and log 10 is less than an order of magnitude, so to a physicist it's all the same :)
Re:Magic Wormhole: get things from one computer to another, ... by ghusbands on Saturday August 17, 2024 @10:31PM (#41279692)
A factor of six is a very long way off, pretty much universally.
Re:Magic Wormhole: get things from one computer to another, ... by mrinfinitiesx on Sunday August 18, 2024 @01:10AM (#41280240)
Yeah but with magic wormholes you see, there could be other universes where that's not the case and 160mbps is close to 1024mbps or 1000mbps whatever the cool kids call a gigabit now adays.
Re:Magic Wormhole: get things from one computer to another, ... by croemer on Sunday August 18, 2024 @09:21AM (#41282224)
Not as far off as the casual reader might think 20MB vs 1Gb sounds way more than the actuall 160Mb vs 1Gb - one shouldn't use Bytes and bits in a direct comparison together. One or the other, otherwise it's misleading/confusing.
Re:Magic Wormhole: get things from one computer to another, ... by bscphil on Sunday August 18, 2024 @04:39PM (#41285306)
In this case transferring the data at the slow rate would have taken more than a week, so it's no small difference. Actually one side had a 10 Gbps line, so if the other side had had faster networking I could easily have exceeded the limit and gotten the transfer done more than 6x faster.

I used the term "1 Gbps line" just because it's a well known quantity - the limitation of Gigabit Ethernet. The point wasn't that multiplexing TCP can get you 6x better speeds, it's that it improved the speed so much that the TCP bandwidth-delay product was no longer the limiting factor in the transfer.

Re:Magic Wormhole: get things from one computer to another, ... by CyberDildonics on Sunday August 18, 2024 @10:08AM (#41282474)
If you sit down and need to wait one hour for one and 6 hours for the other to do the same thing I doubt you would say they are 'not that far off'
Re:Magic Wormhole: get things from one computer to another, ... by themoonisachees on Saturday August 17, 2024 @06:29PM (#41278538)
I overall agree, but "reliable holpunching" is an oxymoron. Hole punching is by definition an exploit of undefined behavior, and I don't see the specs getting updated to support it. UPnP IGD was supposed to be that, but well...
Re:Magic Wormhole: get things from one computer to another, ... by namibj on Saturday August 17, 2024 @08:23PM (#41279167)
Well, with v6 you're down from NAT-hole-punching to Firewall-hole-punching, which in principle should be as simple as arranging the IP:Port pairs of both ends via the setup channel, and then sending a "SYN" packet in both directions at once.

Then, trying to use e.g. TCP Prague (or, I guess, it's congestion control with UDP-native QUIC) as a scalable congestion controller, to take care of the throughout restrictions caused by high bandwidth delay product.

Re:Magic Wormhole: get things from one computer to another, ... by a_subsystem on Wednesday August 21, 2024 @12:56PM (#41312091)
>> sending a "SYN" packet in both directions at once.

Might be a totally dumb question but how does this work? Wouldn’t you already have to have communication to set a time?

Re:Magic Wormhole: get things from one computer to another, ... by bscphil on Saturday August 24, 2024 @08:06PM (#41343031)
That's why protocols like this have what Wormhole calls a "mailbox server", which allows two ends separated by firewalls to do secure key exchange and agree upon a method for punching through directly. See also STUN: https://en.wikipedia.org/wiki/STUN
Re:Magic Wormhole: get things from one computer to another, ... by Uptrenda on Saturday August 17, 2024 @11:16PM (#41279898)
I've been working on this problem for a few years now and have made considerable progress. https://p2pd.readthedocs.io/en/latest/python/index.html

I'm working on a branch that considerably improves the current code and hole punching in it works like a swiss watch. If you're interested you should check out some of the features that work well already.

Re:Magic Wormhole: get things from one computer to another, ... by sleepydog on Sunday August 18, 2024 @03:01PM (#41284508)
As a protocol tcp should be able to utilize a long fat pipe with a large enough receive window. You might want to check what window scaling factor is used and look for a tunable. I accept that some implementations may have limits beyond the protocol level. And even low levels of packet loss can severely affect throughput of a single stream.

A bigger reason you want multiple streams is because most network providers use a stream identifier like the 5-tuple hash to spread traffic, and support single-stream bandwidth much lower than whatever aggregate they may advertise.

Re:Magic Wormhole: get things from one computer to another, ... by bscphil on Sunday August 18, 2024 @04:32PM (#41285258)
> with a large enough receive window

Yeah, that's the issue. I didn't have root permissions on either side. Moreover, a transfer tool should just work without requiring its users to have expert knowledge like this.

In this case, I checked the roundtrip ping time and multiplied it by the buffer size, and it agreed with the speeds I was seeing within ~5%, so it was not an issue with throttling. Actually, if I were a network provider interested in doing this, I would throttle on the 2-tuple as well.

Re:Magic Wormhole: get things from one computer to another, ... by bsharper on Saturday August 17, 2024 @06:48PM (#41278657)
I end up using a combination of scp, LocalSend, magic wormhole and sharedrop.io. Occasionally `python -m http.server` in a pinch for local downloads. It's unfortunate that this xkcd comic is still as relevant as it was in 2011: https://xkcd.com/949/