Commit 3fe10f3e authored by Serene H's avatar Serene H
Browse files

default to wss and some documentation updates, #40

parent d1ec51bf
......@@ -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()
......
###
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
......
......@@ -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]
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment