Unity-Technologies / com.unity.webrtc

WebRTC package for Unity
Other
753 stars 191 forks source link

[Question] Limit WebRTC port range? #101

Open robertgroh opened 4 years ago

robertgroh commented 4 years ago

Is it possible to limit the port ranges used for WebRTC connections? I see, that for UDP connection ports above 60000 and for TCP port in the 54000ish range.

Is there a known default range for UDP or TCP? Also, can I configure a limited port range?

karasusan commented 4 years ago

I guess the limitation of the port range should be controlled by the firewall rule.

example : GCP https://cloud.google.com/vpc/docs/firewalls

robertgroh commented 4 years ago

Hi @karasusan, thank you for your reply.

I guess I can limit the ports, which will be functioning (and returned as SERVER CANDIDATES from the STUN service) via blocks by firewall rules, but I want to know the port ranges, which will be tried in the first place.

Maybe this question is better located at https://github.com/Unity-Technologies/UnityRenderStreaming, what do you think?

karasusan commented 3 years ago

The same question is posted on Unity forum. https://forum.unity.com/threads/unity-webrtc-restrict-datachannel-ports.1025188/

juju812 commented 3 years ago

https://github.com/juju812/com.unity.webrtc/commit/3ef0c0e9d0f8d21f35cf060ecada156d68157914

Hi, @karasusan , here's one snippet implemented the port range feature.

But currently the port range is hard coded in Context class (which is enough for my temporary use), the port range configuration need to be exposed.

karasusan commented 3 years ago

@juju812 I am checking it. Thanks.

juju812 commented 3 years ago

Hi @karasusan

Do you have any schedule to integrate the port range feature? If not, maybe I can follow current configuration tamplate and complete my code. Then I'll create a PR after implement finished.

karasusan commented 3 years ago

@juju812 Thanks. I am sorry but the schedule of the feature will be a long time later.

kannan-xiao4 commented 2 years ago

memo: WRS-238