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

[tor-commits] [snowflake/master] default to wss and some documentation updates, #40



commit 3fe10f3e7c39991193f4322fee55c7067d21831d
Author: Serene H <git@xxxxxxxxxxxxxx>
Date:   Tue Feb 28 22:46:39 2017 -0800

    default to wss and some documentation updates, #40
---
 proxy/proxypair.coffee |  5 +++++
 proxy/snowflake.coffee | 19 ++++++++++++++-----
 proxy/util.coffee      |  1 +
 proxy/websocket.coffee |  4 +++-
 4 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/proxy/proxypair.coffee b/proxy/proxypair.coffee
index b19df09..28696e2 100644
--- a/proxy/proxypair.coffee
+++ b/proxy/proxypair.coffee
@@ -22,6 +22,11 @@ class ProxyPair
   onCleanup:   null
   id:          null
 
+  ###
+  Constructs a ProxyPair where:
+  - @relayAddr is the destination relay
+  - @rateLimit specifies a rate limit on traffic
+  ###
   constructor: (@relayAddr, @rateLimit) ->
     @active = false
     @id = genSnowflakeID()
diff --git a/proxy/snowflake.coffee b/proxy/snowflake.coffee
index 0966053..3068d6a 100644
--- a/proxy/snowflake.coffee
+++ b/proxy/snowflake.coffee
@@ -1,16 +1,21 @@
 ###
 A Coffeescript WebRTC snowflake proxy
-Using Copy-paste signaling for now.
 
-Uses WebRTC from the client, and websocket to the server.
+Uses WebRTC from the client, and Websocket to the server.
 
 Assume that the webrtc client plugin is always the offerer, in which case
 this must always act as the answerer.
 ###
+
+# General snowflake proxy constants.
+# For websocket-specific constants, see websocket.coffee.
 DEFAULT_BROKER = 'snowflake-reg.appspot.com'
 DEFAULT_RELAY =
-  host: '192.81.135.242'
-  port: 9902
+  host: 'snowflake.bamsoftware.com'
+  port: '443'
+  # Original non-wss relay:
+  # host: '192.81.135.242'
+  # port: 9902
 COPY_PASTE_ENABLED = false
 COOKIE_NAME = "snowflake-allow"
 
@@ -174,7 +179,7 @@ class Snowflake
 snowflake = null
 
 # Signalling channel - just tells user to copy paste to the peer.
-# Eventually this should go over the broker.
+# When copy-paste mode is not enabled, this is handled automatically by Broker.
 Signalling =
   send: (msg) ->
     log '---- Please copy the below to peer ----\n'
@@ -205,10 +210,14 @@ log = (msg) ->
 
 dbg = (msg) -> log msg if DEBUG or snowflake.ui?.debug
 
+###
+Entry point.
+###
 init = (isNode) ->
   # Hook up to the debug UI if available.
   ui = if isNode then null else new UI()
   silenceNotifications = Params.getBool(query, 'silent', false)
+  # Establish connectivity information with the Broker.
   brokerUrl = Params.getString(query, 'broker', DEFAULT_BROKER)
   broker = new Broker brokerUrl
   snowflake = new Snowflake broker, ui
diff --git a/proxy/util.coffee b/proxy/util.coffee
index a5b247c..e0d965b 100644
--- a/proxy/util.coffee
+++ b/proxy/util.coffee
@@ -71,6 +71,7 @@ Parse =
     m = spec.match(/^\[([\0-9a-fA-F:.]+)\]:([0-9]+)$/) if !m
     # IPv4 syntax.
     m = spec.match(/^([0-9.]+):([0-9]+)$/) if !m
+    # TODO: Domain match
     return null if !m
 
     host = m[1]
diff --git a/proxy/websocket.coffee b/proxy/websocket.coffee
index 94cf274..a23f53d 100644
--- a/proxy/websocket.coffee
+++ b/proxy/websocket.coffee
@@ -2,6 +2,7 @@
 Only websocket-specific stuff.
 ###
 
+WSS_ENABLED = true
 DEFAULT_PORTS =
   http:  80
   https: 443
@@ -46,7 +47,8 @@ buildUrl = (scheme, host, port, path, params) ->
   parts.join ''
 
 makeWebsocket = (addr) ->
-  url = buildUrl 'ws', addr.host, addr.port, '/'
+  wsProtocol = if WSS_ENABLED then 'wss' else 'ws'
+  url = buildUrl wsProtocol, addr.host, addr.port, '/'
   ws = new WebSocket url
   ###
   'User agents can use this as a hint for how to handle incoming binary data: if



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