Document setting the proxyType for metrics

Trac: 32499
This commit is contained in:
Arlo Breault 2019-12-06 17:54:54 -05:00
parent af4cc52dc2
commit 1e45d48a3c
6 changed files with 16 additions and 8 deletions

View file

@ -122,7 +122,7 @@ var log = function(msg) {
}; };
var dbg = log; 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 ui = new MyUI(); // NOTE: Using the class defined above
var broker = new Broker(config.brokerUrl); 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`. 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 [1]: https://chrome.google.com/webstore/detail/cupcake/dajjbehmbnbppjkcnpdkaniapgdppdnc
[2]: https://trac.torproject.org/projects/tor/wiki/org/teams/AntiCensorshipTeam

View file

@ -1,5 +1,9 @@
class Config {} class Config {
constructor(proxyType) {
this.proxyType = proxyType || '';
}
}
Config.prototype.brokerUrl = 'snowflake-broker.freehaven.net'; Config.prototype.brokerUrl = 'snowflake-broker.freehaven.net';

View file

@ -169,8 +169,7 @@ var debug, snowflake, config, broker, ui, log, dbg, init, update, silenceNotific
return; return;
} }
config = new Config; config = new Config("badge");
config.proxyType = "badge";
if ('off' !== query.get('ratelimit')) { if ('off' !== query.get('ratelimit')) {
config.rateLimitBytes = Params.getByteCount(query, 'ratelimit', config.rateLimitBytes); config.rateLimitBytes = Params.getByteCount(query, 'ratelimit', config.rateLimitBytes);
} }

View file

@ -4,7 +4,7 @@
Entry point. Entry point.
*/ */
var config = new Config; var config = new Config("node");
var ui = new UI(); var ui = new UI();

View file

@ -79,7 +79,7 @@ var snowflake, query, debug, ui, silenceNotifications, log, dbg, init;
init = function() { init = function() {
var broker, config, ui; var broker, config, ui;
config = new Config; config = new Config("testing");
if ('off' !== query['ratelimit']) { if ('off' !== query['ratelimit']) {
config.rateLimitBytes = Params.getByteCount(query, 'ratelimit', config.rateLimitBytes); config.rateLimitBytes = Params.getByteCount(query, 'ratelimit', config.rateLimitBytes);
} }

View file

@ -171,8 +171,7 @@ var debug, snowflake, config, broker, ui, log, dbg, init, update, silenceNotific
}; };
init = function() { init = function() {
config = new Config; config = new Config("webext");
config.proxyType = "webext";
ui = new WebExtUI(); ui = new WebExtUI();
broker = new Broker(config); broker = new Broker(config);
snowflake = new Snowflake(config, ui, broker); snowflake = new Snowflake(config, ui, broker);