From 2555a6c3e845e77e05282afaffae6e534dc616dd Mon Sep 17 00:00:00 2001 From: Maycon Santos Date: Wed, 27 Jul 2022 18:12:39 +0200 Subject: [PATCH] Use proxy when any candidate is relay (#398) We should use relayed port when remote or local candidate is of the relay type --- client/internal/peer/conn.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/internal/peer/conn.go b/client/internal/peer/conn.go index a10d8cee3..3e2739383 100644 --- a/client/internal/peer/conn.go +++ b/client/internal/peer/conn.go @@ -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