Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Snowflake
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Analyze
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
trinity-1686a
Snowflake
Commits
e433af26
Commit
e433af26
authored
9 years ago
by
Serene Han
Browse files
Options
Downloads
Patches
Plain Diff
snowflake terminal turns green when connected
parent
30e7ba79
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
.gitignore
+2
-0
2 additions, 0 deletions
.gitignore
README.md
+2
-1
2 additions, 1 deletion
README.md
proxy/snowflake.coffee
+18
-14
18 additions, 14 deletions
proxy/snowflake.coffee
proxy/snowflake.html
+3
-3
3 additions, 3 deletions
proxy/snowflake.html
with
25 additions
and
18 deletions
.gitignore
+
2
−
0
View file @
e433af26
...
...
@@ -8,3 +8,5 @@ client/client
server/server
snowflake.log
proxy/test
proxy/build
ignore/
This diff is collapsed.
Click to expand it.
README.md
+
2
−
1
View file @
e433af26
...
...
@@ -62,7 +62,8 @@ snowflake to use a default relay.
Look for the offer in terminal C; copy and paste it into the browser.
Copy and paste the answer generated in the browser back to terminal B.
At this point the tor client should bootstrap to 100%.
Once WebRTC successfully connects, the browser terminal should turn green.
Shortly after, the tor client should bootstrap to 100%.
### More
...
...
This diff is collapsed.
Click to expand it.
proxy/snowflake.coffee
+
18
−
14
View file @
e433af26
...
...
@@ -148,6 +148,12 @@ RATE_LIMIT_HISTORY = 5.0
DEFAULT_PORTS
=
http
:
80
https
:
443
# DOM elements.
$msglog
=
null
$send
=
null
$input
=
null
# Build an escaped URL string from unescaped components. Only scheme and host
# are required. See RFC 3986, section 3.
buildUrl
=
(
scheme
,
host
,
port
,
path
,
params
)
->
...
...
@@ -243,10 +249,6 @@ config = {
]
}
# DOM elements
$chatlog
=
null
$send
=
null
$input
=
null
# TODO: Implement
class
Badge
...
...
@@ -411,13 +413,14 @@ class ProxyPair
channel
.
onopen
=
=>
log
'Data channel opened!'
snowflake
.
state
=
MODE
.
WEBRTC_READY
$msglog
.
className
=
'active'
;
# This is the point when the WebRTC datachannel is done, so the next step
# is to establish websocket to the server.
@
connectRelay
()
channel
.
onclose
=
=>
log
'Data channel closed.'
@
state
=
MODE
.
INIT
;
$
chat
log
.
className
=
''
snowflake
.
state
=
MODE
.
INIT
;
$
msg
log
.
className
=
''
channel
.
onerror
=
=>
log
'Data channel error!'
channel
.
onmessage
=
@
onClientToRelayMessage
...
...
@@ -471,11 +474,12 @@ class ProxyPair
relayIsReady
:
->
(
null
!=
@
relay
)
&&
(
WebSocket
.
OPEN
==
@
relay
.
readyState
)
isClosed
:
(
ws
)
->
undefined
==
ws
||
WebSocket
.
CLOSED
==
ws
.
readyState
close
:
->
@
client
.
close
()
if
!
(
isClosed
@
client
)
@
relay
.
close
()
if
!
(
isClosed
@
relay
)
@
client
.
close
()
if
@
webrtcIsReady
()
@
relay
.
close
()
if
@
relayIsReady
()
relay
=
null
maybeCleanup
:
=>
if
@
running
&&
@
isClosed
@
relay
if
@
running
@
running
=
false
# TODO: Call external callback
true
...
...
@@ -518,9 +522,9 @@ welcome = ->
log
=
(
msg
)
->
console
.
log
msg
# Scroll to latest
if
$
chat
log
$
chat
log
.
value
+=
msg
+
'
\n
'
$
chat
log
.
scrollTop
=
$
chat
log
.
scrollHeight
if
$
msg
log
$
msg
log
.
value
+=
msg
+
'
\n
'
$
msg
log
.
scrollTop
=
$
msg
log
.
scrollHeight
Interface
=
# Local input from keyboard into message window.
...
...
@@ -564,8 +568,8 @@ Signalling =
init
=
->
$
chat
log
=
document
.
getElementById
(
'
chat
log'
)
$
chat
log
.
value
=
''
$
msg
log
=
document
.
getElementById
(
'
msg
log'
)
$
msg
log
.
value
=
''
$send
=
document
.
getElementById
(
'send'
)
$send
.
onclick
=
Interface
.
acceptInput
...
...
This diff is collapsed.
Click to expand it.
proxy/snowflake.html
+
3
−
3
View file @
e433af26
...
...
@@ -31,8 +31,8 @@
width
:
50%
;
min-width
:
40em
;
padding
:
0.5em
;
margin
:
auto
;
}
.active
{
background-color
:
#252
;
}
#
chat
log
{
.active
{
background-color
:
rgba
(
0
,
50
,
0
,
0.8
)
;
}
#
msg
log
{
display
:
block
;
width
:
100%
;
min-height
:
40em
;
...
...
@@ -67,7 +67,7 @@
</head>
<body>
<div
class=
"chatarea"
>
<textarea
id=
"
chat
log"
readonly
>
<textarea
id=
"
msg
log"
readonly
>
</textarea>
<div
class=
"inputarea"
>
<input
type=
"text"
id=
"input"
>
...
...
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