[tor-commits] [snowflake/master] Remove the --port option from WebSocket server.

dcf at torproject.org dcf at torproject.org
Thu Jan 19 03:33:40 UTC 2017


commit 3e7825171539708927c4f12f3bb9c22a8e4fd1a9
Author: David Fifield <david at bamsoftware.com>
Date:   Wed Jan 18 19:33:07 2017 -0800

    Remove the --port option from WebSocket server.
    
    Recommend ServerTransportListenAddr in torrc instead.
---
 server/server.go | 12 ++----------
 server/torrc     |  3 ++-
 2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/server/server.go b/server/server.go
index 570de61..5002e4e 100644
--- a/server/server.go
+++ b/server/server.go
@@ -4,7 +4,8 @@
 //
 // Usage in torrc:
 // 	ExtORPort auto
-// 	ServerTransportPlugin snowflake exec server --port 9902
+// 	ServerTransportListenAddr snowflake 0.0.0.0:9902
+// 	ServerTransportPlugin snowflake exec server
 package main
 
 import (
@@ -250,14 +251,12 @@ func main() {
 	var disableTLS bool
 	var certFilename, keyFilename string
 	var logFilename string
-	var port int
 
 	flag.Usage = usage
 	flag.BoolVar(&disableTLS, "disable-tls", false, "don't use HTTPS")
 	flag.StringVar(&certFilename, "cert", "", "TLS certificate file (required without --disable-tls)")
 	flag.StringVar(&keyFilename, "key", "", "TLS private key file (required without --disable-tls)")
 	flag.StringVar(&logFilename, "log", "", "log file to write to")
-	flag.IntVar(&port, "port", 0, "port to listen on if unspecified by Tor")
 	flag.Parse()
 
 	if logFilename != "" {
@@ -290,13 +289,6 @@ func main() {
 
 	listeners := make([]net.Listener, 0)
 	for _, bindaddr := range ptInfo.Bindaddrs {
-		// Override tor's requested port (which is 0 if this transport
-		// has not been run before) with the one requested by the --port
-		// option.
-		if port != 0 {
-			bindaddr.Addr.Port = port
-		}
-
 		switch bindaddr.MethodName {
 		case ptMethodName:
 			var ln net.Listener
diff --git a/server/torrc b/server/torrc
index 5cb891d..74f6af0 100644
--- a/server/torrc
+++ b/server/torrc
@@ -5,4 +5,5 @@ SocksPort 0
 ExitPolicy reject *:*
 DataDirectory datadir
 
-ServerTransportPlugin snowflake exec ./server --disable-tls --log snowflake.log --port 9902
+ServerTransportListenAddr snowflake 0.0.0.0:9902
+ServerTransportPlugin snowflake exec ./server --disable-tls --log snowflake.log



More information about the tor-commits mailing list