This is an automated email from the git hooks/post-receive script.
cohosh pushed a change to branch main in repository pluggable-transports/snowflake-webext.
from ea9285f Update translations for sv fix new b472999 refactor: remove unnecessary checks in `ProxyPair.flush()` new 5f50e52 refactor: remove some dead code new 0233e36 refactor: mark a method as static new 369e06b refactor: remove unnecessary property new 64c66d2 refactor: rename a var new e050640 refactor: add some JSDocs
The 6 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
Summary of changes: proxypair.js | 26 +++++++++----------------- snowflake.js | 4 ++-- 2 files changed, 11 insertions(+), 19 deletions(-)
This is an automated email from the git hooks/post-receive script.
cohosh pushed a commit to branch main in repository pluggable-transports/snowflake-webext.
commit b472999d99d842de721bddf79a8178af84c5065a Author: WofWca wofwca@protonmail.com AuthorDate: Wed Nov 9 00:17:27 2022 +0400
refactor: remove unnecessary checks in `ProxyPair.flush()`
`bufferedAmount` refers to the datachannel buffer, populated by calls to `send`. Data in this buffer does not necessitate additional calls to `flush`. --- proxypair.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/proxypair.js b/proxypair.js index c2dbdcd..d147388 100644 --- a/proxypair.js +++ b/proxypair.js @@ -299,7 +299,7 @@ class ProxyPair { clearTimeout(this.flush_timeout_id); this.flush_timeout_id = null; } - if (this.r2cSchedule.length > 0 || this.c2rSchedule.length > 0 || (this.relayIsReady() && this.relay.bufferedAmount > 0) || (this.webrtcIsReady() && this.client.bufferedAmount > 0)) { + if (this.r2cSchedule.length > 0 || this.c2rSchedule.length > 0) { this.flush_timeout_id = setTimeout(this.flush, this.rateLimit.when() * 1000); } }
This is an automated email from the git hooks/post-receive script.
cohosh pushed a commit to branch main in repository pluggable-transports/snowflake-webext.
commit 5f50e52c70cb65bfb6af3c5a2855c11a2c7daf26 Author: WofWca wofwca@protonmail.com AuthorDate: Wed Nov 9 00:46:33 2022 +0400
refactor: remove some dead code --- proxypair.js | 7 ------- 1 file changed, 7 deletions(-)
diff --git a/proxypair.js b/proxypair.js index d147388..83e83a2 100644 --- a/proxypair.js +++ b/proxypair.js @@ -312,13 +312,6 @@ class ProxyPair { return (null !== this.relay) && (WebSocket.OPEN === this.relay.readyState); }
- /** - * @param {WebSocket} ws - */ - isClosed(ws) { - return undefined === ws || WebSocket.CLOSED === ws.readyState; - } - peerConnOpen() { return (null !== this.pc) && ('closed' !== this.pc.connectionState); }
This is an automated email from the git hooks/post-receive script.
cohosh pushed a commit to branch main in repository pluggable-transports/snowflake-webext.
commit 0233e36e576ba53f03927f927af8a59aa231a80d Author: WofWca wofwca@protonmail.com AuthorDate: Wed Nov 9 00:46:53 2022 +0400
refactor: mark a method as static --- snowflake.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/snowflake.js b/snowflake.js index 30b3296..ca7566d 100644 --- a/snowflake.js +++ b/snowflake.js @@ -134,7 +134,7 @@ class Snowflake { log('incorrect relay url protocol'); return false; } - if (!this.checkRelayPattern(this.config.allowedRelayPattern, hostname)) { + if (!Snowflake.checkRelayPattern(this.config.allowedRelayPattern, hostname)) { log('relay url hostname does not match allowed pattern'); return false; } @@ -192,7 +192,7 @@ class Snowflake { * @return {boolean} * @private */ - checkRelayPattern(pattern, str) { + static checkRelayPattern(pattern, str) { if (typeof pattern !== "string") { throw 'invalid checkRelayPattern input: pattern'; }
This is an automated email from the git hooks/post-receive script.
cohosh pushed a commit to branch main in repository pluggable-transports/snowflake-webext.
commit 369e06bacaf60b9b897be27336dfa07bade3d3ba Author: WofWca wofwca@protonmail.com AuthorDate: Wed Nov 9 12:07:49 2022 +0400
refactor: remove unnecessary property --- proxypair.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/proxypair.js b/proxypair.js index 83e83a2..5d97274 100644 --- a/proxypair.js +++ b/proxypair.js @@ -27,7 +27,6 @@ class ProxyPair { this.relayURL = config.defaultRelayAddr; this.rateLimit = rateLimit; this.config = config; - this.pcConfig = config.pcConfig; this.id = Util.genSnowflakeID(); this.c2rSchedule = []; this.r2cSchedule = []; @@ -37,7 +36,7 @@ class ProxyPair { /** Prepare a WebRTC PeerConnection and await for an SDP offer. */ begin() { /** @private */ - this.pc = new RTCPeerConnection(this.pcConfig); + this.pc = new RTCPeerConnection(this.config.pcConfig); // OnDataChannel triggered remotely from the client when connection succeeds. this.pc.ondatachannel = ({ channel }) => { dbg('Data Channel established...');
This is an automated email from the git hooks/post-receive script.
cohosh pushed a commit to branch main in repository pluggable-transports/snowflake-webext.
commit 64c66d2b8016b5a1f66e5568f777183ddbb13d53 Author: WofWca wofwca@protonmail.com AuthorDate: Wed Nov 9 12:13:42 2022 +0400
refactor: rename a var --- proxypair.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/proxypair.js b/proxypair.js index 5d97274..7658168 100644 --- a/proxypair.js +++ b/proxypair.js @@ -30,7 +30,7 @@ class ProxyPair { this.id = Util.genSnowflakeID(); this.c2rSchedule = []; this.r2cSchedule = []; - this.counted = false; + this.nowConnected = false; }
/** Prepare a WebRTC PeerConnection and await for an SDP offer. */ @@ -117,7 +117,7 @@ class ProxyPair { channel.onopen = () => { log('WebRTC DataChannel opened!'); snowflake.ui.increaseClients(); - this.counted = true; + this.nowConnected = true;
// if we don't receive any keep-alive messages from the client, close the // connection @@ -139,9 +139,9 @@ class ProxyPair { channel.onclose = () => { log('WebRTC DataChannel closed.'); snowflake.ui.setStatus('disconnected by webrtc.'); - if (this.counted) { + if (this.nowConnected) { snowflake.ui.decreaseClients(); - this.counted = false; + this.nowConnected = false; } this.flush(); this.close(); @@ -182,9 +182,9 @@ class ProxyPair { relay.onclose = () => { log(relay.label + ' closed.'); snowflake.ui.setStatus('disconnected.'); - if (this.counted) { + if (this.nowConnected) { snowflake.ui.decreaseClients(); - this.counted = false; + this.nowConnected = false; } this.flush(); this.close();
This is an automated email from the git hooks/post-receive script.
cohosh pushed a commit to branch main in repository pluggable-transports/snowflake-webext.
commit e0506404f82455292694f218954d2f8acd175b7d Author: WofWca wofwca@protonmail.com AuthorDate: Wed Nov 9 12:35:23 2022 +0400
refactor: add some JSDocs --- proxypair.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/proxypair.js b/proxypair.js index 7658168..db37045 100644 --- a/proxypair.js +++ b/proxypair.js @@ -12,7 +12,7 @@ Broker with an WebRTC answer. class ProxyPair {
/** - * @param {*} rateLimit specifies a rate limit on traffic + * @param {DummyRateLimit | BucketRateLimit} rateLimit specifies a rate limit on traffic * @param {Config} config */ constructor(rateLimit, config) {
tor-commits@lists.torproject.org