Commit graph

34 commits

Author SHA1 Message Date
Arlo Breault
2d8a1690ba Initialize snowflake instance with a config 2019-05-16 12:07:06 -04:00
Arlo Breault
3839c2e0b1 Initialize arrays when constructing
Otherwise, this is set on the prototype and shared across instances :/

Note the change to the test that highlights this bug.  A proxy pair was
already created when an earlier test called `beginWebRTC()` but a new
Snowflake instance should start with an empty array.
2019-05-16 12:07:06 -04:00
Arlo Breault
9df66b15b1 Make MODE a class constant 2019-05-16 12:07:06 -04:00
Arlo Breault
898ba57070 Make a few object literals classes 2019-05-08 11:23:49 -04:00
Arlo Breault
bd5887a876 Make a WS class to eliminate globals 2019-05-08 11:23:49 -04:00
Arlo Breault
622005c79e Remove copy/paste signalling 2019-05-08 11:21:56 -04:00
David Fifield
ab34f8e889 Use chunk.byteLength as appropriate for ArrayBuffers.
Without this, running with non-dummy rate limiter (e.g. ?ratelimit=1000)
would try to add undefined to a number resulting in NaN.
2018-12-19 21:30:39 -07:00
David Fifield
7c519b2975 Log WebSocket→WebRTC messages in debug mode.
Same as the other direction.
2018-12-19 21:30:39 -07:00
David Fifield
f06104d182 Only console.log the number of bytes, not the literal message.
It doesn't really help to have a bunch TLS application records
interpreted as a string written to the console.
2018-12-19 21:30:39 -07:00
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
David Fifield
eca7ebb265 Bug 18628: Pass the client_ip parameter in the JavaScript proxy as well. 2017-10-14 15:06:36 -04:00
Serene H
3fe10f3e7c default to wss and some documentation updates, #40 2017-02-28 22:46:39 -08:00
Arlo Breault
d1ec51bfb9 Remove unused clientAddr from ProxyPair 2017-01-23 12:34:08 -08:00
Arlo Breault
e295556254 Standalone snowflake
* Start of #30
2016-12-20 10:36:42 -08:00
Arlo Breault
1d193a38a3 Use logger instead 2016-12-20 08:21:41 -08:00
Serene H
0ae71952d2 additional proxy timeout check 2016-07-25 15:28:10 -07:00
Serene Han
361da32ecb lint proxypair 2016-05-18 13:21:01 -07:00
Arlo Breault
81931fa8e7 Clear ws connection timeout on success/failure
* Follow up to 14fc6a13
2016-05-10 18:46:49 -07:00
Arlo Breault
064875cc29 Fix some logging 2016-05-10 17:04:03 -07:00
Serene Han
14fc6a13c2 timout for websocket connection failure 2016-04-05 10:29:17 -07:00
Serene Han
490b8b33b7 better checks on receiveOffer (#11) 2016-03-15 20:13:39 -07:00
Serene Han
b1e76420bd per-proxypair Snowflake ID generation instead of just one for the Broker (#11) 2016-03-14 22:12:52 -07:00
Serene Han
3339b9f172 simplify proxypair relay onclose 2016-03-13 23:25:47 -07:00
Serene Han
5e318b6219 prepare for multiplexed snowflake (#11) 2016-03-12 22:29:56 -08:00
Serene Han
e35687b587 Disconnections from websocket side also resets browser proxy 2016-02-17 19:55:43 -08:00
Serene Han
547cb9690a more jasmine specs for proxypair, ui, and snowflake coffee files 2016-02-07 08:35:01 -08:00
Serene Han
21c38a04ce Snowflake badge works, and animates when serving client (issue #16) and some logging cleanups 2016-02-03 21:37:21 -08:00
Serene Han
caba2cc8f8 Move all DOM related stuff into ui.coffee 2016-02-03 20:59:13 -08:00
Serene Han
7677707249 Begin embeddable snowflake badge (issue #16) 2016-02-03 20:28:31 -08:00
Serene Han
30bfeb247e Status bar for the snowflake console, instead of cluttered log messages during
polling
2016-01-28 15:21:30 -08:00
Serene Han
77fbfe0e66 Snowflake proxy successfully reset and bootstrap a new client (#15) 2016-01-22 12:22:09 -08:00
Serene Han
c9013b2f80 answer successfully roundtripped back from snowflake proxy through broker to client (#1) 2016-01-21 13:02:46 -08:00
Serene Han
bc1e147ca2 use coffeelint 2016-01-15 08:47:06 -08:00
Serene Han
fa9f58c9ab split and organize coffee files, improve Cake build tasks 2016-01-14 16:28:32 -08:00