Use proxy when any candidate is relay (#398)

We should use relayed port when remote or local
candidate is of the relay type
This commit is contained in:
Maycon Santos 2022-07-27 18:12:39 +02:00 committed by GitHub
parent 86a66c6202
commit 2555a6c3e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -288,6 +288,10 @@ func shouldUseProxy(pair *ice.CandidatePair) bool {
remoteIsPublic := IsPublicIP(remoteIP)
myIsPublic := IsPublicIP(myIp)
if pair.Local.Type() == ice.CandidateTypeRelay || pair.Remote.Type() == ice.CandidateTypeRelay {
return true
}
//one of the hosts has a public IP
if remoteIsPublic && pair.Remote.Type() == ice.CandidateTypeHost {
return false