mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Move probe to WS class for reuse in the badge
This commit is contained in:
parent
685c3bd262
commit
aa107862c5
2 changed files with 32 additions and 26 deletions
|
@ -54,6 +54,20 @@ class WS {
|
|||
return ws;
|
||||
}
|
||||
|
||||
static probeWebsocket(addr) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const ws = WS.makeWebsocket(addr);
|
||||
ws.onopen = () => {
|
||||
resolve();
|
||||
ws.close();
|
||||
};
|
||||
ws.onerror = () => {
|
||||
reject();
|
||||
ws.close();
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WS.WSS_ENABLED = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue