[tor-commits] [snowflake/master] Make Snowflake-specific changes to the websocket server.

dcf at torproject.org dcf at torproject.org
Sat Mar 26 22:26:47 UTC 2016


commit a269053ac205eec949ce133b71a7d1e2b6b3e1e6
Author: David Fifield <david at bamsoftware.com>
Date:   Sat Mar 26 12:34:47 2016 -0700

    Make Snowflake-specific changes to the websocket server.
    
    Change the transport name to "snowflake" and don't report the remote
    client address to the ExtORPort.
---
 server/server.go | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/server/server.go b/server/server.go
index 986fd35..6729266 100644
--- a/server/server.go
+++ b/server/server.go
@@ -1,8 +1,10 @@
-// Tor websocket server transport plugin.
+// Snowflake-specific websocket server plugin. This is the same as the websocket
+// server used by flash proxy, except that it reports the transport name as
+// "snowflake" and does not forward the remote address to the ExtORPort.
 //
 // Usage in torrc:
 // 	ExtORPort 6669
-// 	ServerTransportPlugin websocket exec ./websocket-server --port 9901
+// 	ServerTransportPlugin snowflake exec server --port 9901
 package main
 
 import (
@@ -24,7 +26,7 @@ import (
 	"git.torproject.org/pluggable-transports/websocket.git/websocket"
 )
 
-const ptMethodName = "websocket"
+const ptMethodName = "snowflake"
 const requestTimeout = 10 * time.Second
 
 // "4/3+1" accounts for possible base64 encoding.
@@ -166,7 +168,10 @@ func webSocketHandler(ws *websocket.WebSocket) {
 		handlerChan <- -1
 	}()
 
-	or, err := pt.DialOr(&ptInfo, ws.Conn.RemoteAddr().String(), ptMethodName)
+	// Pass an empty string for the client address. The remote address on
+	// the incoming connection reflects that of the browser proxy, not of
+	// the client. See https://bugs.torproject.org/18628.
+	or, err := pt.DialOr(&ptInfo, "", ptMethodName)
 	if err != nil {
 		log.Printf("Failed to connect to ORPort: " + err.Error())
 		return



More information about the tor-commits mailing list