636 points · by pvsukale3 · 6y ago · 159 comments
The nice thing about WebRTC is this works (pretty much) everywhere! Someone could throw up Python/Android/iOS/Go/Web/C++ Clients really easily. That is really exciting.
Also just a HUGE fan of NAT Traversal/P2P in general. The less dependence we can have on others for sharing our data the better.
Huh, what did I miss?! How do you make a WebRTC-client in language-of-your-choice? The last time I checked for C++ I only found answers like "look at the chrome source". lol.
* https://github.com/pion/webrtc
* https://github.com/aiortc/aiortc
* https://gstreamer.freedesktop.org/documentation/webrtc/index...
Where be at the Node.js verzhun?
I see you are a Recurser (me as well!) I was Summer 2012 I think? Are you doing this as a project during your batch? I would really love to do a talk/deep dive on WebRTC as a talk sometime for Recursers, you should float the idea to Sonali and get me in :p
Definitely give a talk if you can. It's all remote currently!
I really want to get more Go developers into WebRTC/P2P, that was my goal for this year. It is hard to convince conference developers WebRTC is more interesting then all the DevsOps stuff! I am putting in the good fight though.
Also, it sounds like it's using streaming rather than loading the entire file, which would give it an advantage over https://file.pizza, which is what I usually recommend for p2p transfers.
If you like these types of tools, but don't require p2p (or can't use it because of NAT), I'll also plug my own https://patchbay.pub, which will let you do streamed transfers with nothing but curl.
Just a heads up: the homepage still references the old index.html which you say in your blog article might have the wrong paths. Indeed looking at the docs all paths require a mode
In the docs it seems MPMC queues should start with /queue, but it turns out that anything that's not /pubsub or /req,/res just works, so is it really needed ?
Also the doc doesn't specify that pb-method is available to get the requester's method in the request/respond protocol
Anyway those are just minor things, thanks for the service it really rocks
#sender
curl https://patchbay.pub/anders/file.bin --data-binary @file.bin
#receiver
curl https://patchbay.pub/anders/file.bin > file.bin
True story: I was giving a guest lecture on network virtualization at UCI and demoing ZeroTier. One student came up afterwords and asked me how traffic could flow between systems without "a cloud." Evidently the idea that data could just go directly from point A to point B was utterly, completely foreign to the point that they weren't aware that the Internet could be used this way.
Treating end-users like second-class netizen consumers trained people to "need" the cloud to do perfectly normal peer-to-peer things.
What you can't disable is the asymmetry of consumer internet connections (upload << download) and the fact that most consumer devices are not running (or connected to the internet) 24/7.
This is predominately USA mentality. In the rest of the world widespread use of carrier-grade NAT predates mobile networks by decades.
Many residential ISPs don't hand out public IPv4 addresses or require extra payment for them. Some of those ISPs got their first IP block (or even single address!) from someone and never bothered with whole "ask IANA for addresses" thing. It is multi-layer NAT all the way down.
It keeps happening.
But yes, I think there is a massive gap in knowledge here. It's apparent that a lot of the students aren't really interested in CS, just trying to get a degree and a solid job. I think with the competitiveness of college these days kids have lost the freedom to be curious or actually learn about the things that interest them.
I also think there's a wide divide in the quality of teachers, and its a well known problem among the department.
> IP address detection using JavaScript. Starting work on WebRTC API, the web browser communicates with the STUN server and shares information about local and public IP addresses even if you are behind NAT and use a VPN or Proxy. This tool will show if your real public IP is leaking out.
However, if you run the VPN client on the router, there's no problem, because the local machine has no public IP address, just LAN and VPN interface addresses.
Chrome (and maybe other browsers, too) no longer share local IP address. They share the mDNS address instead, which is often generated and registered locally by the browser. It's used only if the peers are on the same network. Else, it's useless but it used to be provided to all peers and malicious websites and they stopped doing that (speaking for those browsers that support mDNS)
Public IP Leak in VPN SOLVED:
In Chromium version 48+, you can set webRTCIPHandlingPolicy to default_public_interface_only which means that any VPN proxy will carry WebRTC media (over UPD if it supports UDP or else over TCP, which impacts quality of transmission)
Your VPN provider just has to provide a Chrome extension to do the above or advise you to do that yourself. That way, the VPN's proxy IP address is what's visible to STUN, not the user's public IP address.
There is also a more elaborate way around it, but the above should work.
For 'Public IP' that sounds like a VPN configuration issue. Your WebRTC Agent should be routing the STUN requests through the VPN (and getting that public IP). But this effects all software/protocols, so don't think it is fair to ding WebRTC for this!
[0] https://bloggeek.me/psa-mdns-and-local-ice-candidates-are-co...
that's the way firefox send does it
it's open source so you could run an instance of it if you wanted to.
Wormhole-style systems don't need to store the data because it's flowing from the sender to the recipient live.
WebRTC is sort of a combination of low-level and high-level APIs, but the ability to control backpressure ends up being very useful.
There are some implementation notes in the README: https://github.com/FiloSottile/go-cpace-ristretto255
https://tools.ietf.org/id/draft-haase-cpace-01.html
IETF post announcing the chosen candidates
https://mailarchive.ietf.org/arch/msg/cfrg/LKbwodpa5yXo6VuND...
Candidate selection process
Someone mentioned the command line client. One can also build and serve the html/js/wasm from anywhere and it should still work, even with the same signalling server. It has pretty lax CORS for this reason.
I think these are similarly likely and have similar (but not identical) mitigations if you're worried you would really be a target for such shenanigans.
If you're running code from a clone of somebody's git repo you're vulnerable to anything they did to that code, just as if you're running code from a web site you're vulnerable to anything they did in that site.
There are marginal differences, and I'm guessing the one you're really excited about is maybe the web site changes moment-by-moment to introduce and remove betrayal mechanics whereas your git clone doesn't change moment-by-moment. Of course that cuts both ways - bugs can be fixed in the site immediately and your clone doesn't magically get bugfixed.
But mostly I'm arguing these are the same problem: Do you trust some well-wisher who has seemingly no reason to betray you? You probably should, life is too short.
Yours is a bit more polished than mine though. I didn't use QR codes either just good old fashioned urls.
EDIT: just learned that WebRTC actually does end-to-end encryption by default, so I'm wrong
If any of that is wrong, please enlighten me, I didn't realize peer to peer connections could be as simple as this.
once the ice candidates are exchanged each side starts spraying the other with STUN messages to addresses ranked by "candidate pairs" that potentially could make a connection until one is found.
this is simplified. there are mechanics like "trickle ice" and fallbacks to proxying via TURN servers.
then there's the alleged idea this is all part of a webrtc "standard", which is laughable cause no browser follows the wild collection of RFCs that supposedly makes up the standard and the only reason any of it works is because there's a non written down general consensus of what's required.
The only extra thing that STUN does is establish a hole punch. It isn't enough to just get your public hole, but you also do a temporary 'port forward' to the person that made the STUN request.
Now I wonder if anyone has made a web frontend of the original.
https://github.com/jimpick/magic-wormhole-service
Not really hardened for production usage.
But I'm assuming it can't break through all NAT routers, right? A good portion of people still won't be able to use this?
A service usable by everyone would require STUN and TURN servers to be set up, no?
Or has WebRTC made advances I'm unaware of?
> A service usable by everyone would require STUN and TURN servers to be set up, no?
Anecdata, of course, but I haven't been able to reliably use any of these WebRTC based file transfer services (file.pizza, instant.io, etc etc). Testing mostly between two computers on the same subnet. Sometimes they work for a little while, at surprisingly low speeds (for two computers connected to the same wireless access point), sometimes I can let them sit for an hour and never get a connection. I've learned to not even bother trying them, it just wastes time.
That said, magic-wormhole (the original) works fine between the same devices, so maybe I'll see if something is somehow different about this implementation.
Edit: ah yes, this service hangs indefinitely on "connecting". You love to see it. (Firefox on Linux - firewall disabled specifically for this test - and Safari on macOS)
Edit: seems to be working in Chrome (Linux) to Firefox (Android). Not sure what the difference is.
There's no TURN server set for this, but it shouldn't be hard to add one. There are NATs where you'd need one to relay all the traffic, but these seem to be relatively rare nowadays. If anyone has any actual statistics on these I'd appreciate it!
AT&T 5G uses Symmetric NAT. It's not rare if you have an iPhone or iPad with cellular. No way to do P2P without relaying traffic unless you want to "guess" the randomized port number, and, on that front, there are NAT-device-aware algorithms that can make that process faster.
We were promised IPv6 will make NAT's not necessary but I believe service providers use NATs not simply to conserve the IPv4 space but to actively discourage using the service to host your own servers.
They are zealously pushing the "ever increasing speeds" of questionable benefit for the user - what for? So that commuters could watch 8k 120fps video while on a bus? Or rather to gather all kind of sensor data in real-time, audio and video included, from their human oil wells? To strip off people's clothes with millimetre wave imaging?
But making it easy for people to run their own home/mobile servers, share and cooperate without govporate oversight is clearly not on their agenda.
Source: https://github.com/saljam/webwormhole/blob/8f707583d68173de3...
On command line it's an option and Google's is default. I'd like to make the signalling server also a STUN server at some point.
I would love to see TCP hole punching in ICE, but it sounds like it is super hard to get right.
Consumer internet does a lot better, lots of those failures come from Government/Military/Medical I bet.
No, it's the users that don't want their (meta)data inspected by a random third party in transit. This is why I don't use filepizza
Folks that care about P2P want to see zero HTTP requests to your server after loading the basic resources.
I want to host it on my router.
I hope this one isn't like that.
Edit: Looks like this is it. https://developer.mozilla.org/en-US/docs/Web/API/ReadableStr...
Edit 2: And yes, this is using it. https://github.com/saljam/webwormhole/blob/master/web/main.j...
[0]: https://github.com/omnistreams/omnistreams-filereader-js/blo...
There is still an open bug for large file transfers: https://github.com/saljam/webwormhole/issues/4
Browsers are pretty restrictive about writing to the file system.
IPFS is not a database, perhaps one could be built on top but then who pins the data and who runs the gateway? IPFS gateways are particularly confounding at this juncture. Until IPFS gets native browser support for pinning and gateways it cannot be the storage layer for a decentralized database.
This kind of technology could help people take back the internet (imo) and webrtc goes a long way toward that goal. Even webrtc doesn't have the full promise of what I am suggesting however, it still requires a server that knows the IP of the other party so that you can directly connect (discovery). This would also need to be decentralized (somehow) perhaps only the discovery of peers would be done over a bootstrapped p2p DHT or something equivalent.
A STUN server is used to get an external network address. TURN servers are used to relay traffic if direct (peer to peer) connection fails.
Could someone share practical usages of these commonly today to help me better grasp usage for these servers as a starting point?
I really like BlogGeek.me for WebRTC info. Here's an entry on the various servers involved.
THIS PROJECT IS STILL IN EARLY DEVELOPMENT, USES EXPERIMENTAL CRYPTOGRAPHIC LIBRARIES, AND HAS NOT HAD ANY KIND OF SECURITY OR CRYPTOGRAPHY REVIEWS. IT MIGHT BE BROKEN AND UNSAFE.
It's just a PAKE then you do a file transfer encrypted with the key you agreed using the PAKE.
PAKEs are very human friendly, they leverage a relatively weak secret (like "Monopoly Vegetable") that humans can deal with, to agree a good quality secret (like an effectively random 128-bit AES key) in such a way that both parties find out if the other party doesn't know the weak secret.
Because humans are bored easily you can use rather weak secrets safely - it's a natural rate limit. An adversary who guesses almost right "Cluedo Animal?" only gets told they're wrong, and after maybe two or three more attempts the legitimate parties are annoyed and refuse to keep trying so their adversary is foiled.
Machines wouldn't naturally use something like this because if a machine has a secure channel to another machine it can just move the 128-bit AES key, not waste time with some weaker human-memorable secret.
This technology won't hide the IP addresses of those communicating
A passive on-path adversary learns the size (perhaps not exactly but at least close) of the file transferred.
And of course an active adversary can prevent the file transfer by spamming the service with nonsense.