Hacker News new | past | comments | ask | show | jobs | submit login

WebRTC with STUN is pure p2p where ffmpeg it requires a rtmp or rtsp server



Just for completeness sake this is what docs [1] state:

"For most WebRTC applications to function a server is required for relaying the traffic between peers, since a direct socket is often not possible between the clients (unless they reside on the same local network). <...>"

[1] https://webrtc.org/getting-started/turn-server


It’s a little more nuanced than this.

https://medium.com/the-making-of-whereby/what-kind-of-turn-s... fippo pulled the stats and saw 17%

This also depends on your clients network. You can determine your NAT mapping type[0] and now ahead of time if you need a TURN server.

To understand NAT behaviors more check out [1]

[0] https://github.com/pion/stun/tree/master/cmd/stun-nat-behavi...

[1] https://webrtcforthecurious.com/docs/03-connecting/#nat-mapp...


Modern networks use IPv6 only, so don't have NAT.


... how is STUN pure p2p ? you still need to have a STUN server somewhere no ?


STUN is just for punching holes in your NAT router, and also discovering what is your public IP address. Both things will be needed for the other peer to know where to reach you. And the other way around.

Once this NAT thing has been done by both parts, and the actual communication has started directly P2P, STUN is not needed any more.


You'd also need a TURN server if both peers are behind NAT without UPnP, which is very common. STUN alone wouldn't be enough.


That is partially incorrect, STUN can punch a hole through even when both sides uses NAT in many cases. That is what I would classify as STUN’s main feature.


Note that parent said “ if both peers are behind NAT without UPnP”. As far as I know, there’s no way to punch holes / open ports automatically without UPnP.


Go read about stun.

You send outgoing packets simultaneously from both sides. Causing both sides to add nat translation entry’s to their nat tables. When the packets arrive both sides already have nat translation entries and the packets go right through the nat.


Punching holes doesn't work only when network devices in between are broken or are actively preventing it.

From the network point of view it looks the same as two hosts starting an outgoing TCP connection through nat - if that works then hole punching should work too.


Not TCP. UDP - there are no connection in UDP, so the routers / firewalls don't really differentiate between a new connection and packets that happen to have the correct ip+port.

Some are trickier than others, as there are 2 IPs and 2 ports in a packet (at any point), and it can be hard to match all of them for the stricter devices, esp. on NATs that do source port randomization.


> when network devices in between are broken or are [maliciously] actively preventing it.

Those are called "middleboxes" (IIRC) and they're unfortunately somewhat pervasive.


> STUN is just for punching holes in your NAT router, and also discovering what is your public IP address.

I know, but what I mean is that "true P2P" on our current internet architecture is not possible, you always need the help of a third party


If we are still in the 90's that definition of "true p2p" would be: two computers with both having public IPs and transferring packets via TCP. But nowadays we are always behind NATs so we became less strict with the definition of what is true p2p


IPv6 is slowly taking over, hopefully in the near future being behind a NAT will be considered abnormal (just like happened with Unicode, we're around 35% = "Unicode 2009", popularity-wise).


Then bittorrent is transcendent p2p?


Your p2p nodes might not be behind NAT. In a lot of populations you can rely on everyone having working v6 for example.

I think the question of what's "pure" p2p is somewhat academic. If your app uses DNS, is it p2p, isn't DNS just a distributed p2p database? Does p2p require that every aspect of your app right down to discovery is distributed among nodes running your app? Is it cheating to use an existing DHT? etc.


You can just use google stun servers they are free to use


Here's a list of public STUN servers (non google too) https://www.voip-info.org/stun/


Careful! P2P streaming video is a (completely non obvious, according to the courts) infringement of the VirNetX patent that for example Apple just had to pay a few billions of dollars for.

If you implement p2p video streaming chances are no company will want to touch it with a ten foot pole.


Um, shouldn't the patent have expired by now ?


Probably not or it would have been on the news and you would start seeing p2p communications again. It’s not rocket science, after all.


But p2p streaming has been around since the mid 2000's ?? (Pre-Microsoft Skype, Miro, Joost, Tribler...)

And for some recent examples : what about Popcorn Time ? Or PeerTube ?

EDIT : Oh, I guess that most of those are technically not "streaming", but "watching while downloading" like YouTube or FTP+VLC ?


The court does not agree with you. A peer to peer communication service, like FaceTime was originally, violates the patents.


Ok, so : when was this patent approved, and when does it expire ?


I think this year but I suggest you look it up yourself, they probably are mentioned in the court documents and the dates are public.


I can't find any specific dates (and I'm not going to go fishing into court documents), but wow, this has been going on for more than a decade now !

https://en.wikipedia.org/wiki/VirnetX

> Separately, in December 2014, Microsoft and VirnetX settled patent disputes over Skype technology for $23 million.


Ahh I see




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: