miroslavpejic85 / mirotalkc2c

✨WebRTC - C2C - Real-time cam-2-cam video calls & screen sharing, end-to-end encrypted, to embed in any website with a simple iframe.
https://c2c.mirotalk.com
GNU Affero General Public License v3.0
232 stars 57 forks source link

No way to configure empty iceServers #5

Closed mlichvar closed 1 year ago

mlichvar commented 1 year ago

If my clients can connect directly to each other and I want to avoid using STUN/TURN servers, it seems iceServers needs to be set to an empty array. It would be nice if that was possible just by editing the .env file and not the source code. Currently it's hardcoded to contain a STUN and TURN server.

miroslavpejic85 commented 1 year ago

Hello @mlichvar,

The STUN server is mandatory and can't be unset, which is why I put it forcing, in case someone doesn't set it at all. While the TURN is highly recommended, in case direct connection between peers is not possible, here You are right, as TURN is not mandatory, I made it optional in the last commit.

The STUN/TURN are configurable in the .env as well, but STUN must be set, if not, it use a google default one: stun:stun.l.google.com:19302. Without it, the signaling server, not knowing the peers IPs, is not able to connect them to each other.

You can install your own, following this doc I made.

This is the MiroTalk C2C logic.

mirotalk-c2c-logic

For any doubts or questions, Join with us on forum, where you can also find many answers. Thank you!

mlichvar commented 1 year ago

Well, it works for me with empty iceServers. This answer explains that it should use just the local addresses when no STUN/TURN is specified: https://stackoverflow.com/questions/32301119/is-ice-necessary-for-client-server-webrtc-applications

I could run coturn on my router, but it doesn't seem to be useful in my case.

miroslavpejic85 commented 1 year ago

If you use it internally to your network, you probably don't need the STUN either. Ok I'll make that optional too.

mlichvar commented 1 year ago

Thanks!

miroslavpejic85 commented 1 year ago

You are welcome! You can keep the Stun/Turn credentials and just enable or disable it, I added also two new params for that:

STUN_SERVER_ENABLED=false # true or false
TURN_SERVER_ENABLED=false # true or false

So, depending on the case, anyone can enable them or not ;)