[tor-commits] [snowflake/master] Remove SnowflakeDataChannel interface.

dcf at torproject.org dcf at torproject.org
Tue Apr 28 03:12:49 UTC 2020


commit 8caa737700d282dc7b174b4df3e514cc02bb0386
Author: David Fifield <david at bamsoftware.com>
Date:   Fri Apr 24 14:41:19 2020 -0600

    Remove SnowflakeDataChannel interface.
    
    Use *webrtc.DataChannel directly.
---
 client/lib/interfaces.go | 7 -------
 client/lib/webrtc.go     | 4 ++--
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/client/lib/interfaces.go b/client/lib/interfaces.go
index fa0bfbe..71426d6 100644
--- a/client/lib/interfaces.go
+++ b/client/lib/interfaces.go
@@ -1,7 +1,6 @@
 package lib
 
 import (
-	"io"
 	"net"
 )
 
@@ -30,9 +29,3 @@ type SocksConnector interface {
 	Reject() error
 	net.Conn
 }
-
-// Interface for the Snowflake's transport. (Typically just webrtc.DataChannel)
-type SnowflakeDataChannel interface {
-	io.Closer
-	Send([]byte) error
-}
diff --git a/client/lib/webrtc.go b/client/lib/webrtc.go
index 91b32e9..cba2574 100644
--- a/client/lib/webrtc.go
+++ b/client/lib/webrtc.go
@@ -21,7 +21,7 @@ type WebRTCPeer struct {
 	id        string
 	config    *webrtc.Configuration
 	pc        *webrtc.PeerConnection
-	transport SnowflakeDataChannel // Holds the WebRTC DataChannel.
+	transport *webrtc.DataChannel
 	broker    *BrokerChannel
 
 	offerChannel  chan *webrtc.SessionDescription
@@ -321,7 +321,7 @@ func (c *WebRTCPeer) cleanup() {
 		if c.pc == nil {
 			panic("DataChannel w/o PeerConnection, not good.")
 		}
-		dataChannel.(*webrtc.DataChannel).Close()
+		dataChannel.Close()
 	} else {
 		c.lock.Unlock()
 	}





More information about the tor-commits mailing list