mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Refactor WebRTC Peer,Dialer's name to be readable
See also: https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/merge_requests/67#note_2771666
This commit is contained in:
parent
657aaa6ba8
commit
6cb82618a0
3 changed files with 8 additions and 8 deletions
|
@ -147,11 +147,11 @@ type WebRTCDialer struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWebRTCDialer(broker *BrokerChannel, iceServers []webrtc.ICEServer, max int) *WebRTCDialer {
|
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.
|
// NewWebRTCDialerWithEvents constructs a new WebRTCDialer.
|
||||||
func NewWebRTCDialer4E(broker *BrokerChannel, iceServers []webrtc.ICEServer, max int, eventLogger event.SnowflakeEventReceiver) *WebRTCDialer {
|
func NewWebRTCDialerWithEvents(broker *BrokerChannel, iceServers []webrtc.ICEServer, max int, eventLogger event.SnowflakeEventReceiver) *WebRTCDialer {
|
||||||
config := webrtc.Configuration{
|
config := webrtc.Configuration{
|
||||||
ICEServers: iceServers,
|
ICEServers: iceServers,
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ func NewWebRTCDialer4E(broker *BrokerChannel, iceServers []webrtc.ICEServer, max
|
||||||
func (w WebRTCDialer) Catch() (*WebRTCPeer, error) {
|
func (w WebRTCDialer) Catch() (*WebRTCPeer, error) {
|
||||||
// TODO: [#25591] Fetch ICE server information from Broker.
|
// TODO: [#25591] Fetch ICE server information from Broker.
|
||||||
// TODO: [#25596] Consider TURN servers here too.
|
// 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.
|
// GetMax returns the maximum number of snowflakes to collect.
|
||||||
|
|
|
@ -137,7 +137,7 @@ func NewSnowflakeClient(config ClientConfig) (*Transport, error) {
|
||||||
max = config.Max
|
max = config.Max
|
||||||
}
|
}
|
||||||
eventsLogger := event.NewSnowflakeEventDispatcher()
|
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
|
return transport, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,15 +38,15 @@ type WebRTCPeer struct {
|
||||||
|
|
||||||
func NewWebRTCPeer(config *webrtc.Configuration,
|
func NewWebRTCPeer(config *webrtc.Configuration,
|
||||||
broker *BrokerChannel) (*WebRTCPeer, error) {
|
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 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
|
// the exchange of SDP information, the creation of a PeerConnection, and the establishment
|
||||||
// of a DataChannel to the Snowflake proxy.
|
// of a DataChannel to the Snowflake proxy.
|
||||||
func NewWebRTCPeer3E(config *webrtc.Configuration,
|
func NewWebRTCPeerWithEvents(config *webrtc.Configuration,
|
||||||
broker *BrokerChannel, eventsLogger event.SnowflakeEventReceiver) (*WebRTCPeer, error) {
|
broker *BrokerChannel, eventsLogger event.SnowflakeEventReceiver) (*WebRTCPeer, error) {
|
||||||
if eventsLogger == nil {
|
if eventsLogger == nil {
|
||||||
eventsLogger = event.NewSnowflakeEventDispatcher()
|
eventsLogger = event.NewSnowflakeEventDispatcher()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue