commit 6cb82618a0f82a15dda617957af8bf08780a482b Author: Shelikhoo xiaokangwang@outlook.com Date: Mon Jan 24 11:51:49 2022 +0000
Refactor WebRTC Peer,Dialer's name to be readable
See also: https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowf... --- client/lib/rendezvous.go | 8 ++++---- client/lib/snowflake.go | 2 +- client/lib/webrtc.go | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/client/lib/rendezvous.go b/client/lib/rendezvous.go index 4c2b240..98cd4d6 100644 --- a/client/lib/rendezvous.go +++ b/client/lib/rendezvous.go @@ -147,11 +147,11 @@ type WebRTCDialer struct { }
func NewWebRTCDialer(broker *BrokerChannel, iceServers []webrtc.ICEServer, max int) *WebRTCDialer { - return NewWebRTCDialer4E(broker, iceServers, max, nil) + return NewWebRTCDialerWithEvents(broker, iceServers, max, nil) }
-// NewWebRTCDialer4E constructs a new WebRTCDialer. -func NewWebRTCDialer4E(broker *BrokerChannel, iceServers []webrtc.ICEServer, max int, eventLogger event.SnowflakeEventReceiver) *WebRTCDialer { +// NewWebRTCDialerWithEvents constructs a new WebRTCDialer. +func NewWebRTCDialerWithEvents(broker *BrokerChannel, iceServers []webrtc.ICEServer, max int, eventLogger event.SnowflakeEventReceiver) *WebRTCDialer { config := webrtc.Configuration{ ICEServers: iceServers, } @@ -169,7 +169,7 @@ func NewWebRTCDialer4E(broker *BrokerChannel, iceServers []webrtc.ICEServer, max func (w WebRTCDialer) Catch() (*WebRTCPeer, error) { // TODO: [#25591] Fetch ICE server information from Broker. // TODO: [#25596] Consider TURN servers here too. - return NewWebRTCPeer3E(w.webrtcConfig, w.BrokerChannel, w.eventLogger) + return NewWebRTCPeerWithEvents(w.webrtcConfig, w.BrokerChannel, w.eventLogger) }
// GetMax returns the maximum number of snowflakes to collect. diff --git a/client/lib/snowflake.go b/client/lib/snowflake.go index 0f637f2..594c62c 100644 --- a/client/lib/snowflake.go +++ b/client/lib/snowflake.go @@ -137,7 +137,7 @@ func NewSnowflakeClient(config ClientConfig) (*Transport, error) { max = config.Max } eventsLogger := event.NewSnowflakeEventDispatcher() - transport := &Transport{dialer: NewWebRTCDialer4E(broker, iceServers, max, eventsLogger), eventDispatcher: eventsLogger} + transport := &Transport{dialer: NewWebRTCDialerWithEvents(broker, iceServers, max, eventsLogger), eventDispatcher: eventsLogger}
return transport, nil } diff --git a/client/lib/webrtc.go b/client/lib/webrtc.go index 328c3a9..282b54d 100644 --- a/client/lib/webrtc.go +++ b/client/lib/webrtc.go @@ -38,15 +38,15 @@ type WebRTCPeer struct {
func NewWebRTCPeer(config *webrtc.Configuration, broker *BrokerChannel) (*WebRTCPeer, error) { - return NewWebRTCPeer3E(config, broker, nil) + return NewWebRTCPeerWithEvents(config, broker, nil) }
-// NewWebRTCPeer3E constructs a WebRTC PeerConnection to a snowflake proxy. +// NewWebRTCPeerWithEvents constructs a WebRTC PeerConnection to a snowflake proxy. // // The creation of the peer handles the signaling to the Snowflake broker, including // the exchange of SDP information, the creation of a PeerConnection, and the establishment // of a DataChannel to the Snowflake proxy. -func NewWebRTCPeer3E(config *webrtc.Configuration, +func NewWebRTCPeerWithEvents(config *webrtc.Configuration, broker *BrokerChannel, eventsLogger event.SnowflakeEventReceiver) (*WebRTCPeer, error) { if eventsLogger == nil { eventsLogger = event.NewSnowflakeEventDispatcher()
tor-commits@lists.torproject.org