Separate peers.go file with improved documentation and more solid interfaces

This commit is contained in:
Serene Han 2016-06-11 18:24:08 -07:00
parent 556596cc5a
commit c63f5cfc0a
5 changed files with 186 additions and 120 deletions

View file

@ -14,6 +14,14 @@ import (
// Implements the |Tongue| interface to catch snowflakes, using a BrokerChannel.
type WebRTCDialer struct {
*BrokerChannel
webrtcConfig *webrtc.Configuration
}
func NewWebRTCDialer(broker *BrokerChannel) *WebRTCDialer {
return &WebRTCDialer{
broker,
webrtc.NewConfiguration(iceServers...),
}
}
// Initialize a WebRTC Connection by signaling through the broker.
@ -33,7 +41,7 @@ func (w WebRTCDialer) Catch() (*webRTCConn, error) {
type webRTCConn struct {
config *webrtc.Configuration
pc *webrtc.PeerConnection
snowflake SnowflakeChannel // Holds the WebRTC DataChannel.
snowflake SnowflakeDataChannel // Holds the WebRTC DataChannel.
broker *BrokerChannel
offerChannel chan *webrtc.SessionDescription