snowflake/proxy
David Fifield aa668bdc92 Set binaryType="arraybuffer" for RTCDataChannel, just as with WebSocket.
The binaryType can be "arraybuffer" or "blob", and "blob" is the
default. The code is only aware of "arraybuffer": I discovered a problem
while running snowflake.html in debug mode; this code fails:
    if DEBUG
      # Go sends only raw bytes...
      if '[object ArrayBuffer]' == recv.toString()
        bytes = new Uint8Array recv
        line = String.fromCharCode.apply(null, bytes)
      line = line.trim()
      log 'WebRTC --> websocket data: ' + line
with the error:
	TypeError: line.trim is not a function[Learn More] snowflake.js:497:16
because recv is of type Blob, not ArrayBuffer.

Despite the unexpected type, the code seemed to work as expected when
not in debug mode. Though the two types provide different interfaces,
they are both valid to pass on to WebSocket.send. The only other thing
we did with it was try to read the .length member for rate-limiting
purposes:
        @rateLimit.update chunk.length
but .length is incorrect for either type: Blob uses .size and
ArrayBuffer uses .byteLength. It worked anyway, because
DummyRateLimit.update doesn't actually look at its argument.

We were already setting binaryType="arraybuffer" for WebSocket
connections.
2018-12-19 21:30:39 -07:00
..
spec Fix the ProxyPair tests exposed by the previous commit. 2018-12-04 15:09:53 -07:00
static Bump last updated date. 2018-12-05 13:39:01 -07:00
broker.coffee move disable check to snowflakeIsDisabled 2017-03-01 18:51:24 -08:00
Cakefile Pass on exit code from spawned task so CI fails 2017-01-18 17:20:13 -08:00
coffeelint.json Downgrade coffeelint line lengths to a "warning" 2017-10-18 11:39:17 -04:00
modernizr-config.json Feature detect with Modernizr 2016-04-05 10:30:45 -07:00
package.json Freeze jasmine until tests are updated for newer version 2018-03-05 20:40:47 -05:00
proxypair.coffee Set binaryType="arraybuffer" for RTCDataChannel, just as with WebSocket. 2018-12-19 21:30:39 -07:00
README.md Remove "broker" and "relay" query params in proxy/README. 2018-12-05 13:40:17 -07:00
shims.coffee Standalone snowflake 2016-12-20 10:36:42 -08:00
snowflake.coffee Bug 28727: remove "broker" and "relay" query string parameters. 2018-12-05 13:35:03 -07:00
ui.coffee Standalone snowflake 2016-12-20 10:36:42 -08:00
util.coffee Fix a local variable reference in BucketRateLimit.when. 2018-12-04 17:14:35 -07:00
websocket.coffee Bug 18628: Pass the client_ip parameter in the JavaScript proxy as well. 2017-10-14 15:06:36 -04:00

This is the browser proxy component of Snowflake.

Embedding

See https://snowflake.torproject.org/ for more info:

<iframe src="https://snowflake.torproject.org/embed.html" width="88" height="16" frameborder="0" scrolling="no"></iframe>

Building

cake build

(Type cake by itself to see possible commands)

Testing

Unit testing with Jasmine are available with:

npm install
npm test

To run locally, either:

  • Navigate to proxy/build/embed.html
  • For a more fully featured "debug" version, start a webserver and navigate to snowflake.html.

Parameters

With no parameters, snowflake uses the default relay snowflake.bamsoftware.com:443 and uses automatic signaling with the default broker at https://snowflake-broker.bamsoftware.com/.

Here are optional parameters to include in the query string.

manual - enables copy-paste signalling mode.