Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Snowflake
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
shelikhoo
Snowflake
Commits
3fe10f3e
Commit
3fe10f3e
authored
8 years ago
by
Serene H
Browse files
Options
Downloads
Patches
Plain Diff
default to wss and some documentation updates, #40
parent
d1ec51bf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
proxy/proxypair.coffee
+5
-0
5 additions, 0 deletions
proxy/proxypair.coffee
proxy/snowflake.coffee
+14
-5
14 additions, 5 deletions
proxy/snowflake.coffee
proxy/util.coffee
+1
-0
1 addition, 0 deletions
proxy/util.coffee
proxy/websocket.coffee
+3
-1
3 additions, 1 deletion
proxy/websocket.coffee
with
23 additions
and
6 deletions
proxy/proxypair.coffee
+
5
−
0
View file @
3fe10f3e
...
...
@@ -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
()
...
...
This diff is collapsed.
Click to expand it.
proxy/snowflake.coffee
+
14
−
5
View file @
3fe10f3e
###
A Coffeescript WebRTC snowflake proxy
Using Copy-paste signaling for now.
Uses WebRTC from the client, and
w
ebsocket to the server.
Uses WebRTC from the client, and
W
ebsocket 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 b
roker.
#
When copy-paste mode is not enabled, this is handled automatically by B
roker.
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
...
...
This diff is collapsed.
Click to expand it.
proxy/util.coffee
+
1
−
0
View file @
3fe10f3e
...
...
@@ -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
]
...
...
This diff is collapsed.
Click to expand it.
proxy/websocket.coffee
+
3
−
1
View file @
3fe10f3e
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment