[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [pluggable-transports/snowflake-webext] 05/06: Use "WebSocket" capitalization in WS interfaces.



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 438abed0b11852b8b1400ad7d0795ef229777d45
Author: David Fifield <david@xxxxxxxxxxxxxxx>
AuthorDate: Wed Mar 29 12:14:17 2023 -0600

    Use "WebSocket" capitalization in WS interfaces.
---
 init-badge.js          |  2 +-
 init-webext.js         |  2 +-
 proxypair.js           |  2 +-
 spec/websocket.spec.js | 16 ++++++++--------
 websocket.js           | 16 ++++++++--------
 5 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/init-badge.js b/init-badge.js
index 4f57348..f2adf72 100644
--- a/init-badge.js
+++ b/init-badge.js
@@ -174,7 +174,7 @@ var
   };
 
   tryProbe = function() {
-    WS.probeWebsocket(config.defaultRelayAddr)
+    WS.probeWebSocket(config.defaultRelayAddr)
     .then(
       () => {
         ui.turnOn();
diff --git a/init-webext.js b/init-webext.js
index 4bbeff9..3c79440 100644
--- a/init-webext.js
+++ b/init-webext.js
@@ -69,7 +69,7 @@ class WebExtUI extends UI {
   }
 
   tryProbe() {
-    WS.probeWebsocket(config.defaultRelayAddr)
+    WS.probeWebSocket(config.defaultRelayAddr)
     .then(
       () => {
         this.missingFeature = false;
diff --git a/proxypair.js b/proxypair.js
index bea1fc0..627607f 100644
--- a/proxypair.js
+++ b/proxypair.js
@@ -165,7 +165,7 @@ class ProxyPair {
     // 52.2.0.
     // https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/remoteDescription
     const clientIP = Parse.ipFromSDP(remoteDescription.sdp);
-    const relay = this.relay = WS.makeWebsocket(this.relayURL, clientIP);
+    const relay = this.relay = WS.makeWebSocket(this.relayURL, clientIP);
     relay.label = 'websocket-relay';
     relay.onopen = () => {
       clearTimeout(this.connectToRelayTimeoutId);
diff --git a/spec/websocket.spec.js b/spec/websocket.spec.js
index 81722da..6e118a8 100644
--- a/spec/websocket.spec.js
+++ b/spec/websocket.spec.js
@@ -1,25 +1,25 @@
-describe('makeWebsocketURL', function() {
+describe('makeWebSocketURL', function() {
   it('attaches client_ip', function() {
     // With no clientIP, should leave query parameters unchanged.
-    expect(WS.makeWebsocketURL('wss://example.com/path', null).toString())
+    expect(WS.makeWebSocketURL('wss://example.com/path', null).toString())
       .toBe('wss://example.com/path');
-    expect(WS.makeWebsocketURL('wss://example.com/path?client_ip=192.0.2.99', null).toString())
+    expect(WS.makeWebSocketURL('wss://example.com/path?client_ip=192.0.2.99', null).toString())
       .toBe('wss://example.com/path?client_ip=192.0.2.99');
-    expect(WS.makeWebsocketURL('wss://example.com/path?client_ip=192.0.2.98&client_ip=192.0.2.99', null).toString())
+    expect(WS.makeWebSocketURL('wss://example.com/path?client_ip=192.0.2.98&client_ip=192.0.2.99', null).toString())
       .toBe('wss://example.com/path?client_ip=192.0.2.98&client_ip=192.0.2.99');
 
     // Should add a client_ip query parameter.
-    expect(WS.makeWebsocketURL('wss://example.com/path', '192.0.2.1').toString())
+    expect(WS.makeWebSocketURL('wss://example.com/path', '192.0.2.1').toString())
       .toBe('wss://example.com/path?client_ip=192.0.2.1');
 
     // Should retain any other existing query parameters.
-    expect(WS.makeWebsocketURL('wss://example.com/path?foo=bar', '192.0.2.1').toString())
+    expect(WS.makeWebSocketURL('wss://example.com/path?foo=bar', '192.0.2.1').toString())
       .toBe('wss://example.com/path?foo=bar&client_ip=192.0.2.1');
 
     // Should overwrite any existing client_ip query parameters.
-    expect(WS.makeWebsocketURL('wss://example.com/path?client_ip=192.0.2.99', '192.0.2.1').toString())
+    expect(WS.makeWebSocketURL('wss://example.com/path?client_ip=192.0.2.99', '192.0.2.1').toString())
       .toBe('wss://example.com/path?client_ip=192.0.2.1');
-    expect(WS.makeWebsocketURL('wss://example.com/path?client_ip=192.0.2.98&client_ip=192.0.2.99', '192.0.2.1').toString())
+    expect(WS.makeWebSocketURL('wss://example.com/path?client_ip=192.0.2.98&client_ip=192.0.2.99', '192.0.2.1').toString())
       .toBe('wss://example.com/path?client_ip=192.0.2.1');
   });
 });
diff --git a/websocket.js b/websocket.js
index 1fbc68b..014f849 100644
--- a/websocket.js
+++ b/websocket.js
@@ -1,17 +1,17 @@
 /*
-Only websocket-specific stuff.
+Only WebSocket-specific stuff.
 */
 
 // eslint-disable-next-line no-unused-vars
 class WS {
   /**
-   * Creates a websocket URL from a base URL and an optional client IP address
+   * Creates a WebSocket URL from a base URL and an optional client IP address
    * string.
    * @param {URL|string} url
    * @param {?string} clientIP
    * @return {URL}
    */
-  static makeWebsocketURL(url, clientIP) {
+  static makeWebSocketURL(url, clientIP) {
     url = new URL(url);
     if (clientIP != null) {
       url.searchParams.set('client_ip', clientIP);
@@ -20,14 +20,14 @@ class WS {
   }
 
   /**
-   * Creates a websocket connection from a URL and an optional client IP address
+   * Creates a WebSocket connection from a URL and an optional client IP address
    * string.
    * @param {URL|string} url
    * @param {?string} clientIP
    * @return {WebSocket}
    */
-  static makeWebsocket(url, clientIP) {
-    let ws = new WebSocket(WS.makeWebsocketURL(url, clientIP));
+  static makeWebSocket(url, clientIP) {
+    let ws = new WebSocket(WS.makeWebSocketURL(url, clientIP));
     /*
     'User agents can use this as a hint for how to handle incoming binary data:
     if the attribute is set to 'blob', it is safe to spool it to disk, and if it
@@ -41,9 +41,9 @@ class WS {
   /**
    * @param {URL | string} addr
    */
-  static probeWebsocket(addr) {
+  static probeWebSocket(addr) {
     return /** @type {Promise<void>} */(new Promise((resolve, reject) => {
-      const ws = WS.makeWebsocket(addr, null);
+      const ws = WS.makeWebSocket(addr, null);
       ws.onopen = () => {
         resolve();
         ws.close();

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits