Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
galene
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
galene
Commits
165c942d
Commit
165c942d
authored
Jan 11, 2021
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add undocumented command /relay-test.
parent
b600be81
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
0 deletions
+54
-0
static/galene.js
static/galene.js
+54
-0
No files found.
static/galene.js
View file @
165c942d
...
@@ -2060,6 +2060,60 @@ commands.wall = {
...
@@ -2060,6 +2060,60 @@ commands.wall = {
},
},
};
};
async
function
relayTest
()
{
let
conf
=
Object
.
assign
({},
serverConnection
.
rtcConfiguration
);
conf
.
iceTransportPolicy
=
'
relay
'
;
let
pc1
=
new
RTCPeerConnection
(
conf
);
let
pc2
=
new
RTCPeerConnection
(
conf
);
pc1
.
onicecandidate
=
e
=>
{
e
.
candidate
&&
pc2
.
addIceCandidate
(
e
.
candidate
);};
pc2
.
onicecandidate
=
e
=>
{
e
.
candidate
&&
pc1
.
addIceCandidate
(
e
.
candidate
);};
try
{
await
new
Promise
(
async
(
resolve
,
reject
)
=>
{
let
d1
=
pc1
.
createDataChannel
(
'
loopbackTest
'
);
d1
.
onopen
=
e
=>
{
d1
.
send
(
'
loopback
'
);
};
let
offer
=
await
pc1
.
createOffer
();
await
pc1
.
setLocalDescription
(
offer
);
await
pc2
.
setRemoteDescription
(
offer
);
let
answer
=
await
pc2
.
createAnswer
();
pc2
.
setLocalDescription
(
answer
);
await
pc1
.
setRemoteDescription
(
answer
);
pc2
.
ondatachannel
=
e
=>
{
let
d2
=
e
.
channel
;
d2
.
onmessage
=
e
=>
{
if
(
e
.
data
===
'
loopback
'
)
resolve
();
else
reject
(
'
unexpected data
'
);
}
}
setTimeout
(()
=>
reject
(
'
timed out
'
),
5000
);
})
}
finally
{
pc1
.
close
();
pc2
.
close
();
}
}
commands
[
'
relay-test
'
]
=
{
f
:
async
(
c
,
r
)
=>
{
addToChatbox
(
null
,
null
,
null
,
Date
.
now
(),
false
,
null
,
`Relay test in progress...`
);
try
{
await
relayTest
();
addToChatbox
(
null
,
null
,
null
,
Date
.
now
(),
false
,
null
,
`Relay test successful.`
);
}
catch
(
e
)
{
addToChatbox
(
null
,
null
,
null
,
Date
.
now
(),
false
,
null
,
'
Relay test failed:
'
+
e
);
}
}
}
function
handleInput
()
{
function
handleInput
()
{
let
input
=
/** @type {HTMLTextAreaElement} */
let
input
=
/** @type {HTMLTextAreaElement} */
(
document
.
getElementById
(
'
input
'
));
(
document
.
getElementById
(
'
input
'
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment