[tor-commits] [pluggable-transports/snowflake-webext] 05/15: refactor: mark some methods and props as private

gitolite role git at cupani.torproject.org
Wed Nov 9 14:40:54 UTC 2022


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 c38fa4e2c81ea340dc3438b77d0d9486ff3091a0
Author: WofWca <wofwca at protonmail.com>
AuthorDate: Fri Nov 4 16:49:30 2022 +0400

    refactor: mark some methods and props as private
---
 proxypair.js | 16 ++++++++++++++--
 snowflake.js |  4 ++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/proxypair.js b/proxypair.js
index ecce907..2532a2e 100644
--- a/proxypair.js
+++ b/proxypair.js
@@ -38,12 +38,14 @@ class ProxyPair {
 
   /** Prepare a WebRTC PeerConnection and await for an SDP offer. */
   begin() {
+    /** @private */
     this.pc = new RTCPeerConnection(this.pcConfig);
     // OnDataChannel triggered remotely from the client when connection succeeds.
     this.pc.ondatachannel = (dc) => {
       const channel = dc.channel;
       dbg('Data Channel established...');
       this.prepareDataChannel(channel);
+      /** @private */
       this.client = channel;
     };
   }
@@ -113,6 +115,7 @@ class ProxyPair {
   /**
    * Given a WebRTC DataChannel, prepare callbacks.
    * @param {RTCDataChannel} channel
+   * @private
    */
   prepareDataChannel(channel) {
     // if we don't receive any keep-alive messages from the client, close the
@@ -155,7 +158,10 @@ class ProxyPair {
     channel.onmessage = this.onClientToRelayMessage;
   }
 
-  /** Assumes WebRTC datachannel is connected. */
+  /**
+   * Assumes WebRTC datachannel is connected.
+   * @private
+   */
   connectRelay() {
     dbg('Connecting to relay...');
     // Get a remote IP address from the PeerConnection, if possible. Add it to
@@ -203,6 +209,7 @@ class ProxyPair {
   /**
    * WebRTC --> websocket
    * @param {MessageEvent} msg
+   * @private
    */
   onClientToRelayMessage(msg) {
     dbg('WebRTC --> websocket data: ' + msg.data.byteLength + ' bytes');
@@ -215,6 +222,7 @@ class ProxyPair {
   /**
    * websocket --> WebRTC
    * @param {MessageEvent} event
+   * @private
    */
   onRelayToClientMessage(event) {
     dbg('websocket --> WebRTC data: ' + event.data.byteLength + ' bytes');
@@ -222,6 +230,7 @@ class ProxyPair {
     this.flush();
   }
 
+  /** @private */
   onError(event) {
     const ws = event.target;
     log(ws.label + ' error.');
@@ -245,7 +254,10 @@ class ProxyPair {
     this.onCleanup();
   }
 
-  /** Send as much data in both directions as the rate limit currently allows. */
+  /**
+   * Send as much data in both directions as the rate limit currently allows.
+   * @private
+   */
   flush() {
     let busy = true;
     while (busy && !this.rateLimit.isLimited()) {
diff --git a/snowflake.js b/snowflake.js
index 0fd2acc..9af003e 100644
--- a/snowflake.js
+++ b/snowflake.js
@@ -62,6 +62,7 @@ class Snowflake {
   /**
    * Regularly poll Broker for clients to serve until this snowflake is
    * serving at capacity, at which point stop polling.
+   * @private
    */
   pollBroker() {
     // Poll broker for clients.
@@ -133,6 +134,7 @@ class Snowflake {
    * @param {string} desc
    * @param {string | undefined} relayURL
    * @returns {boolean} `true` on success, `false` on fail.
+   * @private
    */
   receiveOffer(pair, desc, relayURL) {
     try {
@@ -167,6 +169,7 @@ class Snowflake {
 
   /**
    * @returns {ProxyPair}
+   * @private
    */
   makeProxyPair() {
     const pair = new ProxyPair(this.relayAddr, this.rateLimit, this.config);
@@ -199,6 +202,7 @@ class Snowflake {
    * @param {string} pattern
    * @param {string} str typically a domain name to be checked
    * @return {boolean}
+   * @private
    */
   checkRelayPattern(pattern, str) {
     if (typeof pattern !== "string") {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tor-commits mailing list