aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorTommaso Gragnato <gragnato.tommaso@icloud.com>2022-08-14 14:34:57 +0200
committeritchyonion <itchyonion@torproject.org>2022-09-26 08:52:23 -0700
commit9ce1de4eee4e23c918c7c5e96666ff5c6ddc654e (patch)
treef5982ee017fa887f2aa114577fd2ac2695aa725a /client
parenta8829d49b7bd315db08713abd4bf7396466d8b59 (diff)
downloadsnowflake-9ce1de4eee4e23c918c7c5e96666ff5c6ddc654e.tar.gz
snowflake-9ce1de4eee4e23c918c7c5e96666ff5c6ddc654e.zip
Use Pion's Setting Engine to reduce Multicast DNS noise
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40123 The purpose of the patch is to prevent Pion from opening the mDNS port, thus preventing snowflake from directly leaking .local candidates. What this doesn't prevent is the resolution of .local candidates once they are passed on to the system DNS.
Diffstat (limited to 'client')
-rw-r--r--client/lib/webrtc.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/client/lib/webrtc.go b/client/lib/webrtc.go
index d5264a9..01990e0 100644
--- a/client/lib/webrtc.go
+++ b/client/lib/webrtc.go
@@ -10,6 +10,7 @@ import (
"time"
"git.torproject.org/pluggable-transports/snowflake.git/v2/common/event"
+ "github.com/pion/ice/v2"
"github.com/pion/webrtc/v3"
)
@@ -189,7 +190,10 @@ func (c *WebRTCPeer) connect(config *webrtc.Configuration, broker *BrokerChannel
// after ICE candidate gathering is complete..
func (c *WebRTCPeer) preparePeerConnection(config *webrtc.Configuration) error {
var err error
- c.pc, err = webrtc.NewPeerConnection(*config)
+ s := webrtc.SettingEngine{}
+ s.SetICEMulticastDNSMode(ice.MulticastDNSModeDisabled)
+ api := webrtc.NewAPI(webrtc.WithSettingEngine(s))
+ c.pc, err = api.NewPeerConnection(*config)
if err != nil {
log.Printf("NewPeerConnection ERROR: %s", err)
return err