[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [pluggable-transports/snowflake] 01/04: proxy: Add a SnowflakeProxy.makeWebRTCAPI() method
This is an automated email from the git hooks/post-receive script.
meskio pushed a commit to branch main
in repository pluggable-transports/snowflake.
commit 5e564f36ff639eae2289be5a9e937e98ab62ee75
Author: KokaKiwi <kokakiwi+git@xxxxxxxxxxxx>
AuthorDate: Fri Sep 30 17:51:28 2022 +0200
proxy: Add a SnowflakeProxy.makeWebRTCAPI() method
---
proxy/lib/snowflake.go | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/proxy/lib/snowflake.go b/proxy/lib/snowflake.go
index f9bcddb..f2828bf 100644
--- a/proxy/lib/snowflake.go
+++ b/proxy/lib/snowflake.go
@@ -347,6 +347,14 @@ func (d dataChannelHandlerWithRelayURL) datachannelHandler(conn *webRTCConn, rem
d.sf.datachannelHandler(conn, remoteAddr, d.RelayURL)
}
+func (sf *SnowflakeProxy) makeWebRTCAPI() *webrtc.API {
+ settingsEngine := webrtc.SettingEngine{}
+
+ settingsEngine.SetICEMulticastDNSMode(ice.MulticastDNSModeDisabled)
+
+ return webrtc.NewAPI(webrtc.WithSettingEngine(settingsEngine))
+}
+
// Create a PeerConnection from an SDP offer. Blocks until the gathering of ICE
// candidates is complete and the answer is available in LocalDescription.
// Installs an OnDataChannel callback that creates a webRTCConn and passes it to
@@ -356,9 +364,7 @@ func (sf *SnowflakeProxy) makePeerConnectionFromOffer(sdp *webrtc.SessionDescrip
dataChan chan struct{},
handler func(conn *webRTCConn, remoteAddr net.Addr)) (*webrtc.PeerConnection, error) {
- s := webrtc.SettingEngine{}
- s.SetICEMulticastDNSMode(ice.MulticastDNSModeDisabled)
- api := webrtc.NewAPI(webrtc.WithSettingEngine(s))
+ api := sf.makeWebRTCAPI()
pc, err := api.NewPeerConnection(config)
if err != nil {
return nil, fmt.Errorf("accept: NewPeerConnection: %s", err)
@@ -446,9 +452,7 @@ func (sf *SnowflakeProxy) makePeerConnectionFromOffer(sdp *webrtc.SessionDescrip
func (sf *SnowflakeProxy) makeNewPeerConnection(config webrtc.Configuration,
dataChan chan struct{}) (*webrtc.PeerConnection, error) {
- s := webrtc.SettingEngine{}
- s.SetICEMulticastDNSMode(ice.MulticastDNSModeDisabled)
- api := webrtc.NewAPI(webrtc.WithSettingEngine(s))
+ api := sf.makeWebRTCAPI()
pc, err := api.NewPeerConnection(config)
if err != nil {
return nil, fmt.Errorf("accept: NewPeerConnection: %s", err)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits