webrtc-rs / webrtc

A pure Rust implementation of WebRTC
https://webrtc.rs
Apache License 2.0
4.12k stars 365 forks source link

How do I configure the public IP to announce for host ICE candidates? #620

Open SoftMemes opened 1 week ago

SoftMemes commented 1 week ago

I have a webrtc service based on this library. It has ports open on UDP and available on the public network without any firewalls etc. However, the public IP address of the service (its VM) is not known from inside the machine - it is not one of the IP addresses listed on the local network interfaces.

How can I control the IP address that is used to announce host ICE candidates so that peers can connect directly to my service on its public IP?

r-byondlabs commented 11 hours ago

Thats where STUN/ICE come into picture: https://webrtcforthecurious.com/docs/03-connecting/#ice

Once you configure the STUN servers, the candidates are discovered through that, which will also include your public gateway IP.