mirror of
https://github.com/keroserene/snowflake.git
synced 2026-08-18 13:08:58 +02:00
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.
|
||
|---|---|---|
| .. | ||
| spec | ||
| static | ||
| broker.coffee | ||
| Cakefile | ||
| coffeelint.json | ||
| modernizr-config.json | ||
| package.json | ||
| proxypair.coffee | ||
| README.md | ||
| shims.coffee | ||
| snowflake.coffee | ||
| ui.coffee | ||
| util.coffee | ||
| websocket.coffee | ||
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.