[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [snowflake/master] Document setting the proxyType for metrics
commit 1e45d48a3c4ef05434916d963f0c00d8c0246ac9
Author: Arlo Breault <arlolra@xxxxxxxxx>
Date: Fri Dec 6 17:54:54 2019 -0500
Document setting the proxyType for metrics
Trac: 32499
---
proxy/README.md | 8 +++++++-
proxy/config.js | 6 +++++-
proxy/init-badge.js | 3 +--
proxy/init-node.js | 2 +-
proxy/init-testing.js | 2 +-
proxy/init-webext.js | 3 +--
6 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/proxy/README.md b/proxy/README.md
index fedfa20..33b8738 100644
--- a/proxy/README.md
+++ b/proxy/README.md
@@ -122,7 +122,7 @@ var log = function(msg) {
};
var dbg = log;
-var config = new Config();
+var config = new Config("myui"); // NOTE: Set a unique proxy type for metrics
var ui = new MyUI(); // NOTE: Using the class defined above
var broker = new Broker(config.brokerUrl);
@@ -134,4 +134,10 @@ snowflake.beginWebRTC();
This minimal setup is pretty much what's currently in `init-node.js`.
+When configuring the snowflake, set a unique `proxyType` (first argument
+to `Config`) that will be used when recording metrics at the broker. Also,
+it would be helpful to get in touch with the [Anti-Censorship Team][2] at the
+Tor Project to let them know about your tool.
+
[1]: https://chrome.google.com/webstore/detail/cupcake/dajjbehmbnbppjkcnpdkaniapgdppdnc
+[2]: https://trac.torproject.org/projects/tor/wiki/org/teams/AntiCensorshipTeam
diff --git a/proxy/config.js b/proxy/config.js
index 2b698a6..39c2b15 100644
--- a/proxy/config.js
+++ b/proxy/config.js
@@ -1,5 +1,9 @@
-class Config {}
+class Config {
+ constructor(proxyType) {
+ this.proxyType = proxyType || '';
+ }
+}
Config.prototype.brokerUrl = 'snowflake-broker.freehaven.net';
diff --git a/proxy/init-badge.js b/proxy/init-badge.js
index 2e0a261..cb066e8 100644
--- a/proxy/init-badge.js
+++ b/proxy/init-badge.js
@@ -169,8 +169,7 @@ var debug, snowflake, config, broker, ui, log, dbg, init, update, silenceNotific
return;
}
- config = new Config;
- config.proxyType = "badge";
+ config = new Config("badge");
if ('off' !== query.get('ratelimit')) {
config.rateLimitBytes = Params.getByteCount(query, 'ratelimit', config.rateLimitBytes);
}
diff --git a/proxy/init-node.js b/proxy/init-node.js
index 73c25dc..b5a60d8 100644
--- a/proxy/init-node.js
+++ b/proxy/init-node.js
@@ -4,7 +4,7 @@
Entry point.
*/
-var config = new Config;
+var config = new Config("node");
var ui = new UI();
diff --git a/proxy/init-testing.js b/proxy/init-testing.js
index f553f12..01b6147 100644
--- a/proxy/init-testing.js
+++ b/proxy/init-testing.js
@@ -79,7 +79,7 @@ var snowflake, query, debug, ui, silenceNotifications, log, dbg, init;
init = function() {
var broker, config, ui;
- config = new Config;
+ config = new Config("testing");
if ('off' !== query['ratelimit']) {
config.rateLimitBytes = Params.getByteCount(query, 'ratelimit', config.rateLimitBytes);
}
diff --git a/proxy/init-webext.js b/proxy/init-webext.js
index afa9aee..3eb42dd 100644
--- a/proxy/init-webext.js
+++ b/proxy/init-webext.js
@@ -171,8 +171,7 @@ var debug, snowflake, config, broker, ui, log, dbg, init, update, silenceNotific
};
init = function() {
- config = new Config;
- config.proxyType = "webext";
+ config = new Config("webext");
ui = new WebExtUI();
broker = new Broker(config);
snowflake = new Snowflake(config, ui, broker);
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits