[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [snowflake/master] provide IceServerList flag as variadic arg to webrtc Configuration (#24)



commit 4e6bba559a77634c4dde38e6702e37bc4f364fd4
Author: Serene Han <keroserene+git@xxxxxxxxx>
Date:   Fri Mar 4 13:21:44 2016 -0800

    provide IceServerList flag as variadic arg to webrtc Configuration (#24)
---
 client/snowflake.go | 3 +--
 client/torrc        | 3 ++-
 client/util.go      | 6 ++++--
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/client/snowflake.go b/client/snowflake.go
index 4af76e8..4287425 100644
--- a/client/snowflake.go
+++ b/client/snowflake.go
@@ -63,8 +63,7 @@ func dialWebRTC() (*webRTCConn, error) {
 
 	// TODO: [#3] Fetch ICE server information from Broker.
 	// TODO: [#18] Consider TURN servers here too.
-	config := webrtc.NewConfiguration(
-		webrtc.OptionIceServer("stun:stun.l.google.com:19302"))
+	config := webrtc.NewConfiguration(iceServers...)
 
 	broker := NewBrokerChannel(brokerURL, frontDomain)
 	if nil == broker {
diff --git a/client/torrc b/client/torrc
index 9af942b..c4af61f 100644
--- a/client/torrc
+++ b/client/torrc
@@ -3,6 +3,7 @@ DataDirectory datadir
 
 ClientTransportPlugin snowflake exec ./client \
 -url https://snowflake-reg.appspot.com/ \
--front www.google.com
+-front www.google.com \
+-ice stun:stun.l.google.com:19302
 
 Bridge snowflake 0.0.3.0:1
diff --git a/client/util.go b/client/util.go
index 2a54f6a..02132f2 100644
--- a/client/util.go
+++ b/client/util.go
@@ -2,6 +2,7 @@ package main
 
 import (
 	"fmt"
+	"github.com/keroserene/go-webrtc"
 	"log"
 	"strings"
 	"time"
@@ -11,7 +12,7 @@ const (
 	LogTimeInterval = 5
 )
 
-type IceServerList []string
+type IceServerList []webrtc.ConfigurationOption
 
 func (i *IceServerList) String() string {
 	return fmt.Sprint(*i)
@@ -20,7 +21,8 @@ func (i *IceServerList) String() string {
 func (i *IceServerList) Set(s string) error {
 	for _, server := range strings.Split(s, ",") {
 		// TODO: STUN / TURN url format validation?
-		*i = append(*i, server)
+		option := webrtc.OptionIceServer(server)
+		*i = append(*i, option)
 	}
 	return nil
 }

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits