[tor-commits] [snowflake/master] prepare IceServerList client flag (#24)
serene at torproject.org
serene at torproject.org
Fri Mar 4 21:22:53 UTC 2016
commit 3ec771df01770d708bd5cc8c90156ee4c7e9cff6
Author: Serene Han <keroserene+git at gmail.com>
Date: Thu Mar 3 22:51:10 2016 -0800
prepare IceServerList client flag (#24)
---
client/snowflake.go | 3 +++
client/util.go | 16 ++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/client/snowflake.go b/client/snowflake.go
index 25ccfef..4af76e8 100644
--- a/client/snowflake.go
+++ b/client/snowflake.go
@@ -22,6 +22,7 @@ var ptInfo pt.ClientInfo
// var logFile *os.File
var brokerURL string
var frontDomain string
+var iceServers IceServerList
// When a connection handler starts, +1 is written to this channel; when it
// ends, -1 is written.
@@ -109,6 +110,7 @@ func handler(conn *pt.SocksConn) error {
// TODO: Make SOCKS acceptance more independent from WebRTC so they can
// be more easily interchanged.
+
copyLoop(conn, remote)
// <-remote.endChannel
log.Println("----END---")
@@ -161,6 +163,7 @@ func main() {
webrtc.SetLoggingVerbosity(1)
flag.StringVar(&brokerURL, "url", "", "URL of signaling broker")
flag.StringVar(&frontDomain, "front", "", "front domain")
+ flag.Var(&iceServers, "ice", "comma-separated list of ICE servers")
flag.Parse()
logFile, err := os.OpenFile("snowflake.log", os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600)
if err != nil {
diff --git a/client/util.go b/client/util.go
index abefa04..2a54f6a 100644
--- a/client/util.go
+++ b/client/util.go
@@ -1,7 +1,9 @@
package main
import (
+ "fmt"
"log"
+ "strings"
"time"
)
@@ -9,6 +11,20 @@ const (
LogTimeInterval = 5
)
+type IceServerList []string
+
+func (i *IceServerList) String() string {
+ return fmt.Sprint(*i)
+}
+
+func (i *IceServerList) Set(s string) error {
+ for _, server := range strings.Split(s, ",") {
+ // TODO: STUN / TURN url format validation?
+ *i = append(*i, server)
+ }
+ return nil
+}
+
type BytesInfo struct {
outboundChan chan int
inboundChan chan int
More information about the tor-commits
mailing list