From e233d4fd72e406443a95bab8d9b265fb047c63cc Mon Sep 17 00:00:00 2001 From: Lunar Date: Sun, 17 Nov 2013 15:39:49 +0100 Subject: [PATCH 01/16] =?utf8?q?Services=C2=A0:=20simplification=20de=20la?= =?utf8?q?=20formule=20pour=20expliquer=20marcuse?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Services.mdwn | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Services.mdwn b/Services.mdwn index 2a2a146..084f720 100644 --- a/Services.mdwn +++ b/Services.mdwn @@ -34,13 +34,10 @@ Nos oignons fait actuellement fonctionner les relais Tor suivants : - 1,2 : `marcuse1` et `marcuse2` sont sur une même machine. Quand Tor est - utilisé en tant que client (pour par exemple aller sur le web) celui-ci - ne consomme que très peu de ressource. Sur un relais avec une forte - capacité, la charge de Tor est beaucoup plus importante. Pour l'instant - Tor ne gère pas bien les multi-processeurs, il est donc nécessaire de - faire tourner plusieurs instances de Tor afin d'utiliser toute la - capacité mise à notre disposition par l'hébergeur, d'où les deux noms. + 1,2 : marcuse1 et marcuse2 sont sur une même + machine. Afin de palier à des limitations techniques du logiciel dans + la gestion du multi-cœur, il est nécessaire de faire fonctionner deux + relais afin de pouvoir utiliser toute la bande passante disponible. -- 2.39.5 From a67d4d960a266d5b428fe221655b1bdd052d4ee2 Mon Sep 17 00:00:00 2001 From: website Date: Sun, 17 Nov 2013 15:40:28 +0100 Subject: [PATCH 02/16] =?utf8?q?Fichiers=20PO=20mis=20=C3=A0=20jour.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Services.en.po | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Services.en.po b/Services.en.po index 5dc6543..c00749f 100644 --- a/Services.en.po +++ b/Services.en.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: Nos oignons website\n" -"POT-Creation-Date: 2013-11-17 15:28+0100\n" +"POT-Creation-Date: 2013-11-17 15:40+0100\n" "PO-Revision-Date: 2013-11-17 14:45+0100\n" "Last-Translator: Nos oignons \n" "Language-Team: English \n" @@ -54,13 +54,10 @@ msgid "" " \n" " \n" " \n" -" 1,2 : `marcuse1` et `marcuse2` sont sur une même machine. Quand Tor est\n" -" utilisé en tant que client (pour par exemple aller sur le web) celui-ci\n" -" ne consomme que très peu de ressource. Sur un relais avec une forte\n" -" capacité, la charge de Tor est beaucoup plus importante. Pour l'instant\n" -" Tor ne gère pas bien les multi-processeurs, il est donc nécessaire de\n" -" faire tourner plusieurs instances de Tor afin d'utiliser toute la\n" -" capacité mise à notre disposition par l'hébergeur, d'où les deux noms.\n" +" 1,2 : marcuse1 et marcuse2 sont sur une même\n" +" machine. Afin de palier à des limitations techniques du logiciel dans\n" +" la gestion du multi-cœur, il est nécessaire de faire fonctionner deux\n" +" relais afin de pouvoir utiliser toute la bande passante disponible.\n" " \n" " \n" " \n" -- 2.39.5 From cc50749a1eba1168c575deb926d3227cc2d94dd2 Mon Sep 17 00:00:00 2001 From: Lunar Date: Sun, 17 Nov 2013 15:45:45 +0100 Subject: [PATCH 03/16] =?utf8?q?Mise=20=C3=A0=20jour=20des=20traductions?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Services.en.po | 94 ++++++++++++++++++++++++-------------------------- 1 file changed, 46 insertions(+), 48 deletions(-) diff --git a/Services.en.po b/Services.en.po index c00749f..ba68054 100644 --- a/Services.en.po +++ b/Services.en.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: Nos oignons website\n" "POT-Creation-Date: 2013-11-17 15:40+0100\n" -"PO-Revision-Date: 2013-11-17 14:45+0100\n" +"PO-Revision-Date: 2013-11-17 16:00+0100\n" "Last-Translator: Nos oignons \n" "Language-Team: English \n" "Language: en\n" @@ -69,50 +69,48 @@ msgid "" " \n" "\n" msgstr "" - -#, fuzzy -#~| msgid "" -#~| "| Emplacement | Relai | Empreinte | Politique de sortie | | ----------- " -#~| "| ----- | --------- | ------------------- | | [Liazo](http://www.liazo." -#~| "fr/) | [marcuse1](https://atlas.torproject.org/" -#~| "#details/011FDD1EE84DAC7758119B69829C74A9D197B35E) | `011F DD1E E84D " -#~| "AC77 5811 9B69 829C 74A9 D197 B35E` | [Reduced Exit Policy](https://trac." -#~| "torproject.org/projects/tor/wiki/doc/ReducedExitPolicy) | | [Liazo]" -#~| "(http://www.liazo.fr/) | [marcuse2](https://atlas.torproject.org/" -#~| "#details/1A503BBFFC82A4EFD75DB46A071A7340E11A9DB9) | `1A50 3BBF FC82 " -#~| "A4EF D75D B46A 071A 7340 E11A 9DB9` | [Reduced Exit Policy](https://trac." -#~| "torproject.org/projects/tor/wiki/doc/ReducedExitPolicy) | | [Gandi]" -#~| "(https://www.gandi.net/) | [ekumen](https://atlas.torproject.org/" -#~| "#details/7F2CD6BD548C5FFA09B20A0C5CB07893C9451653) | `7F2C D6BD 548C " -#~| "5FFA 09B2 0A0C 5CB0 7893 C945 1653` | [Reduced Exit Policy](https://trac." -#~| "torproject.org/projects/tor/wiki/doc/ReducedExitPolicy) |" -#~ msgid "" -#~ "| Emplacement | Relai | Empreinte | Politique de sortie | | ----------- | " -#~ "----- | --------- | ------------------- | | [Liazo](http://www.liazo.fr/) " -#~ "| [marcuse1](https://atlas.torproject.org/" -#~ "#details/011FDD1EE84DAC7758119B69829C74A9D197B35E) [^1] | `011F DD1E E84D " -#~ "AC77 5811 9B69 829C 74A9 D197 B35E` | [Reduced Exit Policy](https://trac." -#~ "torproject.org/projects/tor/wiki/doc/ReducedExitPolicy) | | [Liazo]" -#~ "(http://www.liazo.fr/) | [marcuse2](https://atlas.torproject.org/" -#~ "#details/1A503BBFFC82A4EFD75DB46A071A7340E11A9DB9) [^2] | `1A50 3BBF FC82 " -#~ "A4EF D75D B46A 071A 7340 E11A 9DB9` | [Reduced Exit Policy](https://trac." -#~ "torproject.org/projects/tor/wiki/doc/ReducedExitPolicy) | | [Gandi]" -#~ "(https://www.gandi.net/) [^3] | [ekumen](https://atlas.torproject.org/" -#~ "#details/7F2CD6BD548C5FFA09B20A0C5CB07893C9451653) | `7F2C D6BD 548C 5FFA " -#~ "09B2 0A0C 5CB0 7893 C945 1653` | [Reduced Exit Policy](https://trac." -#~ "torproject.org/projects/tor/wiki/doc/ReducedExitPolicy) |" -#~ msgstr "" -#~ "| Location | Relay | Fingerprint | Exit policy |\n" -#~ "| ----------- | ----- | --------- | ------------------- |\n" -#~ "| [Liazo](http://www.liazo.fr/) | [marcuse1](https://atlas.torproject.org/" -#~ "#details/011FDD1EE84DAC7758119B69829C74A9D197B35E) | `011F DD1E E84D AC77 " -#~ "5811 9B69 829C 74A9 D197 B35E` | [Reduced Exit Policy](https://trac." -#~ "torproject.org/projects/tor/wiki/doc/ReducedExitPolicy) |\n" -#~ "| [Liazo](http://www.liazo.fr/) | [marcuse2](https://atlas.torproject.org/" -#~ "#details/1A503BBFFC82A4EFD75DB46A071A7340E11A9DB9) | `1A50 3BBF FC82 A4EF " -#~ "D75D B46A 071A 7340 E11A 9DB9` | [Reduced Exit Policy](https://trac." -#~ "torproject.org/projects/tor/wiki/doc/ReducedExitPolicy) |\n" -#~ "| [Gandi](https://www.gandi.net/) | [ekumen](https://atlas.torproject.org/" -#~ "#details/7F2CD6BD548C5FFA09B20A0C5CB07893C9451653) | `7F2C D6BD 548C 5FFA " -#~ "09B2 0A0C 5CB0 7893 C945 1653` | [Reduced Exit Policy](https://trac." -#~ "torproject.org/projects/tor/wiki/doc/ReducedExitPolicy) |" +"\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +"
LocationRelayFingeprintExit policy
Liazomarcuse11011F DD1E E84D AC77 5811 9B69 829C 74A9 D197 B35EReduced Exit Policy
Liazomarcuse221A50 3BBF FC82 A4EF D75D B46A 071A 7340 E11A 9DB9Reduced Exit Policy
Gandi3ekumen7F2C D6BD 548C 5FFA 09B2 0A0C 5CB0 7893 C945 1653Reduced Exit Policy
\n" +" 1,2 : marcuse1 and marcuse2 are on the same\n" +" server. Due to technical limitations in how the software handle\n" +" multicore, we need to run two distinct relays in order to use all\n" +" available bandwidth.\n" +"
\n" +" 3 : All resources are kindly sponsored by Gandi (virtual machine and bandwidth).\n" +"
\n" -- 2.39.5 From e85e10f848f89cd9e82c405d7f377e10de3b1979 Mon Sep 17 00:00:00 2001 From: Lunar Date: Sun, 17 Nov 2013 15:47:30 +0100 Subject: [PATCH 04/16] =?utf8?q?Partenaires=C2=A0:=20Ajout=20de=20Liazo=20?= =?utf8?q?et=20de=20Gandi?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Partenaires.mdwn | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Partenaires.mdwn b/Partenaires.mdwn index 0c1af78..309232f 100644 --- a/Partenaires.mdwn +++ b/Partenaires.mdwn @@ -4,6 +4,8 @@ L'association travaille avec : * Hébergement : - [tetaneutral.net](http://www.tetaneutral.net/) + - [Liazo](http://www.liazo.fr/) + - [Gandi](https://www.gandi.net/) - [OFTC](http://www.oftc.net/) * Conseils juridiques : - [Maître Olivier Hugot](http://www.hugot.fr/) @@ -23,11 +25,6 @@ L'association travaille avec : - [Keyringer](https://keyringer.sarava.org/) - *et encore de nombreux autres…* -[[!if test="prototype" - then=""" - - [Liazo](http://www.liazo.fr/) -"""]] - Un grand merci à toutes celles et ceux qui participent à *faire* Internet, au développement de Tor ainsi qu'à toutes celles et ceux qui luttent pour préserver et construire des espaces de liberté dans ce monde. -- 2.39.5 From a867a8d6f023db7d9265ceef1c9260ecb7d2cfb0 Mon Sep 17 00:00:00 2001 From: Lunar Date: Sun, 17 Nov 2013 22:25:59 +0100 Subject: [PATCH 05/16] =?utf8?q?Services=C2=A0:=20ajout=20des=20graphs=20d?= =?utf8?q?e=20bande=20passante?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Le code est sûrement à refactoriser et à mettre aux bons endroits du site. --- Services/Participation.html | 181 ++++++++++++++++++++++++++++++++++++ 1 file changed, 181 insertions(+) diff --git a/Services/Participation.html b/Services/Participation.html index 60b5552..4683683 100644 --- a/Services/Participation.html +++ b/Services/Participation.html @@ -123,3 +123,184 @@ new ConsensusPieDrawer().draw(); new ExitPieDrawer().draw(); + +

Bandwidth

+ +

3 days / read

+
+

3 days / write

+
+

1 week / read

+
+

1 week / write

+
+

1 month / read

+
+

1 month / write

+
+

3 months / read

+
+

3 months / write

+
+

1 year / read

+
+

1 year / write

+
+ + + + -- 2.39.5 From 6ba22ed07ee3e37bce41c9a7c814d105b2621d70 Mon Sep 17 00:00:00 2001 From: Lunar Date: Sun, 17 Nov 2013 22:36:52 +0100 Subject: [PATCH 06/16] =?utf8?q?Services=C2=A0:=20on=20d=C3=A9finit=20les?= =?utf8?q?=20relais=20dans=20l'ordre=20d'arriv=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Sinon, on ne garde pas la même couleur d'une courbe à l'autre lors de l'arrivée d'un nouveau relai, et c'est pas très joli. --- assets/relays.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/relays.js b/assets/relays.js index 64838ee..e2b113d 100644 --- a/assets/relays.js +++ b/assets/relays.js @@ -1,9 +1,9 @@ var nos_oignons_relays = [ - { name: "marcuse1", + { name: "ekumen", + fingerprint: "7F2CD6BD548C5FFA09B20A0C5CB07893C9451653", + }, { name: "marcuse1", fingerprint: "011FDD1EE84DAC7758119B69829C74A9D197B35E", }, { name: "marcuse2", fingerprint: "1A503BBFFC82A4EFD75DB46A071A7340E11A9DB9", - }, { name: "ekumen", - fingerprint: "7F2CD6BD548C5FFA09B20A0C5CB07893C9451653", }, ]; -- 2.39.5 From 5e5ec4cf05ebd15a7d1e9f2cf0d5f3cfa1a156d1 Mon Sep 17 00:00:00 2001 From: Lunar Date: Sun, 17 Nov 2013 22:37:30 +0100 Subject: [PATCH 07/16] =?utf8?q?Services=C2=A0:=20on=20cache=20les=20morce?= =?utf8?q?aux=20de=20courbes=20pour=20lesquels=20on=20a=20pas=20toutes=20l?= =?utf8?q?es=20donn=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Services/Participation.html | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Services/Participation.html b/Services/Participation.html index 4683683..56ae6db 100644 --- a/Services/Participation.html +++ b/Services/Participation.html @@ -214,8 +214,8 @@ function draw_bandwidth_graph(raw_data, selector, direction, period) { }); color.domain(valid_fingerprints); - var minTime = d3.min(raw_data.relays.map(function(d) { return d[direction][period] && parseTime(d[direction][period].first); })); - var maxTime = d3.max(raw_data.relays.map(function(d) { return d[direction][period] && parseTime(d[direction][period].last); })); + var minTime = d3.max(raw_data.relays.map(function(d) { return d[direction][period] && parseTime(d[direction][period].first); })); + var maxTime = d3.min(raw_data.relays.map(function(d) { return d[direction][period] && parseTime(d[direction][period].last); })); var maxTotalBandwidth = 0; var data = stack(color.domain().map(function(fingerprint) { @@ -227,13 +227,9 @@ function draw_bandwidth_graph(raw_data, selector, direction, period) { var last = parseTime(history.last); var i = 0; for (var current = minTime; current <= maxTime; current = d3.time.second.offset(current, history.interval)) { - var value; - if (current < first || current > last) { - value = 0; - } else { - value = history.factor * history.values[i++]; + if (first <= current && current <= last) { + values.push({ date: current, y: history.factor * history.values[i++] }); } - values.push({ date: current, y: value }); } maxTotalBandwidth = maxTotalBandwidth + history.factor * d3.max(history.values); -- 2.39.5 From 3d13cca22c30b933b47345dfffc30d69f52bb04d Mon Sep 17 00:00:00 2001 From: Lunar Date: Sun, 17 Nov 2013 22:39:38 +0100 Subject: [PATCH 08/16] C'est pas beau de mentir --- assets/relays.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/relays.js b/assets/relays.js index e2b113d..056db5c 100644 --- a/assets/relays.js +++ b/assets/relays.js @@ -1,8 +1,8 @@ var nos_oignons_relays = [ - { name: "ekumen", - fingerprint: "7F2CD6BD548C5FFA09B20A0C5CB07893C9451653", - }, { name: "marcuse1", + { name: "marcuse1", fingerprint: "011FDD1EE84DAC7758119B69829C74A9D197B35E", + }, { name: "ekumen", + fingerprint: "7F2CD6BD548C5FFA09B20A0C5CB07893C9451653", }, { name: "marcuse2", fingerprint: "1A503BBFFC82A4EFD75DB46A071A7340E11A9DB9", }, -- 2.39.5 From 2cb8e87fc24531c4ee62a74e5bc4bb1bdaa67162 Mon Sep 17 00:00:00 2001 From: Lunar Date: Sun, 17 Nov 2013 22:55:18 +0100 Subject: [PATCH 09/16] =?utf8?q?Services=C2=A0:=20meilleur=20=C3=A9chelle?= =?utf8?q?=20verticale=20pour=20la=20bande=20passante?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Services/Participation.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Services/Participation.html b/Services/Participation.html index 56ae6db..0d34eb0 100644 --- a/Services/Participation.html +++ b/Services/Participation.html @@ -164,12 +164,12 @@ new ExitPieDrawer().draw();

Bandwidth

@@ -156,16 +156,12 @@ new ExitPieDrawer().draw(); shape-rendering: crispEdges; } -.relay text { - text-anchor: end; -} - -- 2.39.5 From 8432d2f44740eaccd47c14abe52b1df01f5bb6d6 Mon Sep 17 00:00:00 2001 From: Lunar Date: Sat, 23 Nov 2013 17:41:51 +0100 Subject: [PATCH 16/16] Proprification et mise en place des graphs --- README | 7 + Services.en.po | 156 ++++++++++++++++- Services.mdwn | 58 +++++++ Services/Participation.html | 328 ------------------------------------ assets/bw_graphs.css | 19 +++ assets/bw_graphs.js | 224 ++++++++++++++++++++++++ assets/l10n.en.js | 12 ++ assets/l10n.fr.js | 12 ++ assets/pie_graphs.js | 94 +++++++++++ 9 files changed, 580 insertions(+), 330 deletions(-) delete mode 100644 Services/Participation.html create mode 100644 assets/bw_graphs.css create mode 100644 assets/bw_graphs.js create mode 100644 assets/l10n.en.js create mode 100644 assets/l10n.fr.js create mode 100644 assets/pie_graphs.js diff --git a/README b/README index 44cdc40..089fb03 100644 --- a/README +++ b/README @@ -49,3 +49,10 @@ Images Les sources des images utilisés se trouve dans le répertoire `Site_web` du dépôt « comm ». + +Modification de la liste des relais +----------------------------------- + +La liste des relais gérés par Nos oignons se trouve à deux endroits : +`Services.mdwn` et `assets/relays.js`. Il faut bien penser à tout mettre à +jour. diff --git a/Services.en.po b/Services.en.po index ba68054..3d0d655 100644 --- a/Services.en.po +++ b/Services.en.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: Nos oignons website\n" -"POT-Creation-Date: 2013-11-17 15:40+0100\n" -"PO-Revision-Date: 2013-11-17 16:00+0100\n" +"POT-Creation-Date: 2013-11-23 19:39+0100\n" +"PO-Revision-Date: 2013-11-23 19:50+0100\n" "Last-Translator: Nos oignons \n" "Language-Team: English \n" "Language: en\n" @@ -10,11 +10,137 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#. type: Plain text +#, no-wrap +msgid "[[!meta script=\"assets/l10n.fr\"]]\n" +msgstr "[[!meta script=\"assets/l10n.en\"]]\n" + +#. type: Plain text +#, no-wrap +msgid "[[!meta script=\"assets/relays\"]]\n" +msgstr "[[!meta script=\"assets/relays\"]]\n" + +#. type: Plain text +#, no-wrap +msgid "[[!meta script=\"assets/d3/d3.v3.min\"]]\n" +msgstr "[[!meta script=\"assets/d3/d3.v3.min\"]]\n" + +#. type: Plain text +#, no-wrap +msgid "[[!meta script=\"assets/bw_graphs\"]]\n" +msgstr "[[!meta script=\"assets/bw_graphs\"]]\n" + +#. type: Plain text +#, no-wrap +msgid "[[!meta stylesheet=\"assets/bw_graphs\" rel=\"stylesheet\"]]\n" +msgstr "[[!meta stylesheet=\"assets/bw_graphs\" rel=\"stylesheet\"]]\n" + +#. type: Plain text +#, no-wrap +msgid "[[!meta script=\"assets/pie_graphs\"]]\n" +msgstr "[[!meta script=\"assets/pie_graphs\"]]\n" + #. type: Plain text #, no-wrap msgid "[[!meta title=\"Services\"]]\n" msgstr "[[!meta title=\"Services\"]]\n" +#. type: Plain text +#, no-wrap +msgid "\n" +msgstr "" +"new ConsensusPieDrawer(\"#consensus-pie\").draw();\n" +"new ExitPieDrawer(\"#exit-pie\").draw();\n" +"\n" + +#. type: Title = +#, no-wrap +msgid "Relais\n" +msgstr "Relays\n" + #. type: Plain text msgid "Nos oignons fait actuellement fonctionner les relais Tor suivants :" msgstr "Nos Oignons currently runs the following Tor relays:" @@ -114,3 +240,29 @@ msgstr "" " \n" " \n" "\n" + +#. type: Plain text +#, no-wrap +msgid "" +"\n" +msgstr "" +"new BwDrawer(\"#bandwidth\").draw();\n" +"\n" diff --git a/Services.mdwn b/Services.mdwn index 084f720..88bb60c 100644 --- a/Services.mdwn +++ b/Services.mdwn @@ -1,5 +1,53 @@ +[[!meta script="assets/l10n.fr"]] +[[!meta script="assets/relays"]] +[[!meta script="assets/d3/d3.v3.min"]] +[[!meta script="assets/bw_graphs"]] +[[!meta stylesheet="assets/bw_graphs" rel="stylesheet"]] +[[!meta script="assets/pie_graphs"]] [[!meta title="Services"]] + + +Relais +====== + Nos oignons fait actuellement fonctionner les relais Tor suivants : @@ -48,3 +96,13 @@ Nos oignons fait actuellement fonctionner les relais Tor suivants :
+ + diff --git a/Services/Participation.html b/Services/Participation.html deleted file mode 100644 index e3edb65..0000000 --- a/Services/Participation.html +++ /dev/null @@ -1,328 +0,0 @@ -[[!meta script="assets/relays"]] -[[!meta script="assets/d3/d3.v3.min"]] - - - -
-

Consensus weight

-
-
-
-

Exit probability

-
-
-
- - - -

Bandwidth

- -

3 days / read

-
-

3 days / write

-
-

1 week / read

-
-

1 week / write

-
-

1 month / read

-
-

1 month / write

-
-

3 months / read

-
-

3 months / write

-
-

1 year / read

-
-

1 year / write

-
- - - - diff --git a/assets/bw_graphs.css b/assets/bw_graphs.css new file mode 100644 index 0000000..a455147 --- /dev/null +++ b/assets/bw_graphs.css @@ -0,0 +1,19 @@ +.axis path, +.axis line { + fill: none; + stroke: #000; + shape-rendering: crispEdges; +} + +#bandwidth form { + margin: auto; + width: 35em; +} + +#bandwidth div { + float: left; + width: 7em; +} +#bandwidth svg { + clear: left; +} diff --git a/assets/bw_graphs.js b/assets/bw_graphs.js new file mode 100644 index 0000000..bcd0216 --- /dev/null +++ b/assets/bw_graphs.js @@ -0,0 +1,224 @@ +function BwDrawer(selector) { + this.selector = selector; +}; +BwDrawer.prototype = new BwDrawer(); + +BwDrawer.margin = {top: 50, right: 10, bottom: 90, left: 130}; +BwDrawer.width = 600 - BwDrawer.margin.left - BwDrawer.margin.right; +BwDrawer.height = 400 - BwDrawer.margin.top - BwDrawer.margin.bottom; + +BwDrawer.parseTime = d3.time.format("%Y-%m-%d %H:%M:%S").parse; +BwDrawer.bwFormatter = d3.format(".f"); + +BwDrawer.x = d3.time.scale() + .range([0, BwDrawer.width]); + +BwDrawer.y = d3.scale.linear() + .range([BwDrawer.height, 0]); + +BwDrawer.color = d3.scale.category20(); + +BwDrawer.xAxis = d3.svg.axis() + .scale(BwDrawer.x) + .orient("bottom"); + +BwDrawer.yAxis = d3.svg.axis() + .scale(BwDrawer.y) + .orient("left") + .tickFormat(function(d) { return (d == 0) ? "" : BwDrawer.bwFormatter(Math.abs(d)) + " Mbit/s " + ((d > 0) ? "in" : "out"); }); + +BwDrawer.area = d3.svg.area() + .x(function(d) { return BwDrawer.x(d.date); }) + .y0(function(d) { return BwDrawer.y(d.y0); }) + .y1(function(d) { return BwDrawer.y(d.y0 + d.y); }); + +BwDrawer.read_stack = d3.layout.stack() + .values(function(d) { return d.read_values; }); +BwDrawer.write_stack = d3.layout.stack() + .values(function(d) { return d.write_values; }); + +BwDrawer.onionoo_url = "https://onionoo.torproject.org/bandwidth?type=relay&contact=adminsys@nos-oignons.net"; + +BwDrawer.periods = [ + { id: "3_days", label: L10n.t_3_days }, + { id: "1_week", label: L10n.t_1_week }, + { id: "1_month", label: L10n.t_1_month }, + { id: "3_months", label: L10n.t_3_months }, + { id: "1_year", label: L10n.t_1_year }, + ]; + +BwDrawer.extract_values = function(history, interval, minTime, maxTime) { + var values = []; + var first = history ? BwDrawer.parseTime(history.first) : maxTime; + var last = history ? BwDrawer.parseTime(history.last) : minTime; + var i = 0; + for (var current = minTime; current <= maxTime; current = d3.time.second.offset(current, interval)) { + values.push({ date: current, + y: (first <= current && current <= last) ? history.factor * history.values[i++] * 8 / 1000000 : 0 + }); + } + return values; +} + +BwDrawer.draw_bandwidth_graph = function(raw_data, selector, period) { + var update_period; + + var svg = d3.select(selector).append("svg") + .attr("width", BwDrawer.width + BwDrawer.margin.left + BwDrawer.margin.right) + .attr("height", BwDrawer.height + BwDrawer.margin.top + BwDrawer.margin.bottom) + .append("g") + .attr("transform", "translate(" + BwDrawer.margin.left + "," + BwDrawer.margin.top + ")"); + + var form = d3.select(selector).append("form") + .attr("action", "#"); + BwDrawer.periods.forEach(function(p) { + var div = form.append("div"); + var radio = div.append("input") + .attr("type", "radio") + .attr("name", "period") + .attr("id", "period_" + p.id) + .on("click", function() { update_period(p.id); }); + div.append("label") + .attr("for", "period_" + p.id) + .text(p.label); + if (p.id == BwDrawer.periods[0].id) { + radio.attr("checked", true); + } + }); + + var valid_fingerprints = []; + nos_oignons_relays.forEach(function(r) { + var relay_data = raw_data["relays"].filter(function(d) { return d.fingerprint == r.fingerprint; })[0]; + valid_fingerprints.push(r.fingerprint); + }); + BwDrawer.color.domain(valid_fingerprints); + + var bw_data = {}; + BwDrawer.periods.map(function(p) { return p.id; }).forEach(function(period) { + var interval = d3.max(raw_data.relays, function(d) { + return d['read_history'][period] && d['read_history'][period].interval; + }); + raw_data.relays.forEach(function(d) { + if ((d['read_history'][period] && d['read_history'][period].interval != interval) || + (d['write_history'][period] && d['write_history'][period].interval != interval)) { + throw "PANIC: Different interval for different relays in the same time period."; + } + }); + var minTime = d3.max(raw_data.relays, function(d) { + return d['read_history'][period] && BwDrawer.parseTime(d['read_history'][period].first) && + d['write_history'][period] && BwDrawer.parseTime(d['write_history'][period].first); + }); + var maxTime = d3.min(raw_data.relays, function(d) { + return d['read_history'][period] && BwDrawer.parseTime(d['read_history'][period].last) && + d['write_history'][period] && BwDrawer.parseTime(d['write_history'][period].last); + }); + + var maxReadBandwidth = 0; + var maxWriteBandwidth = 0; + + var values = BwDrawer.color.domain().map(function(fingerprint) { + var relay_data = raw_data["relays"].filter(function(d) { return d.fingerprint == fingerprint; })[0]; + var read_history = relay_data['read_history'][period]; + var write_history = relay_data['write_history'][period]; + var read_values = BwDrawer.extract_values(read_history, interval, minTime, maxTime); + var write_values = BwDrawer.extract_values(write_history, interval, minTime, maxTime); + + maxReadBandwidth = maxReadBandwidth + d3.max(read_values, function(d) { return d.y; }); + maxWriteBandwidth = maxWriteBandwidth + d3.max(write_values, function(d) { return d.y; }); + + return { + fingerprint: fingerprint, + read_values: read_values, + write_values: write_values.map(function(d) { d.y = -d.y; return d }) + }; + }); + bw_data[period] = { minTime: minTime, + maxTime: maxTime, + maxReadBandwidth: maxReadBandwidth, + maxWriteBandwidth: maxWriteBandwidth, + values: values }; + }); + + BwDrawer.y.domain([-d3.max(d3.values(bw_data), function(d) { return d.maxWriteBandwidth; }), + d3.max(d3.values(bw_data), function(d) { return d.maxReadBandwidth; })]); + + var initial_period = BwDrawer.periods[0].id; + + BwDrawer.x.domain([bw_data[initial_period].minTime, bw_data[initial_period].maxTime]); + + var read_graph = svg.selectAll(".read_graph") + .data(BwDrawer.read_stack(bw_data[initial_period].values)) + .enter().append("path") + .attr("class", "read_graph area") + .attr("d", function(d) { return BwDrawer.area(d.read_values); }) + .style("fill", function(d) { return BwDrawer.color(d.fingerprint); }); + + var write_graph = svg.selectAll(".write_graph") + .data(BwDrawer.write_stack(bw_data[initial_period].values)) + .enter().append("path") + .attr("class", "write_graph area") + .attr("d", function(d) { return BwDrawer.area(d.write_values); }) + .style("fill", function(d) { return BwDrawer.color(d.fingerprint); }); + + update_period = function(period) { + BwDrawer.x.domain([bw_data[period].minTime, bw_data[period].maxTime]); + var t = svg.transition().duration(300); + t.select(".x.axis").call(BwDrawer.xAxis); + t.selectAll(".read_graph").style("fill-opacity", 0); + t.selectAll(".write_graph").style("fill-opacity", 0); + t.each("end", function() { + d3.selectAll(".read_graph").data(BwDrawer.read_stack(bw_data[period].values)); + d3.selectAll(".write_graph").data(BwDrawer.write_stack(bw_data[period].values)); + d3.selectAll(".read_graph").attr("d", function(d) { return BwDrawer.area(d.read_values); }) + d3.selectAll(".write_graph") + .attr("d", function(d) { return BwDrawer.area(d.write_values); }) + var t2 = svg.transition().duration(100); + t2.selectAll(".read_graph").style("fill-opacity", 1); + t2.selectAll(".write_graph").style("fill-opacity", 1); + }); + d3.selectAll(".x.axis text") + .style("text-anchor", "end") + .attr("transform", "rotate(-90) translate(-10, 0)"); + } + + svg.append("g") + .attr("class", "x axis") + .attr("transform", "translate(0," + BwDrawer.height + ")") + .call(BwDrawer.xAxis) + .selectAll("text") + .style("text-anchor", "end") + .attr("transform", "rotate(-90) translate(-10, 0)"); + + svg.append("g") + .attr("class", "y axis") + .call(BwDrawer.yAxis); + + var legend = svg.selectAll(".legend") + .data(BwDrawer.color.domain().slice().reverse()) + .enter().append("g") + .attr("class", "legend") + .attr("transform", function(d, i) { return "translate(0," + ((i * 20) - BwDrawer.margin.top) + ")"; }); + + legend.append("rect") + .attr("x", BwDrawer.width - 18) + .attr("width", 18) + .attr("height", 18) + .style("fill", BwDrawer.color); + + legend.append("text") + .attr("x", BwDrawer.width - 24) + .attr("y", 9) + .attr("dy", ".35em") + .style("text-anchor", "end") + .text(function(d) { + return nos_oignons_relays.filter(function(r) { return r.fingerprint == d; })[0].name; + }); +}; + +BwDrawer.prototype.draw = function() { + var selector = this.selector; + d3.json(BwDrawer.onionoo_url, function(error, raw_data) { + d3.select(selector).text(""); + BwDrawer.draw_bandwidth_graph(raw_data, selector); + }); +}; diff --git a/assets/l10n.en.js b/assets/l10n.en.js new file mode 100644 index 0000000..f89d7a5 --- /dev/null +++ b/assets/l10n.en.js @@ -0,0 +1,12 @@ +function L10n() { }; +L10n.loading = "Loading…"; +L10n.consensus_weight = "Weight in the whole network"; +L10n.exit_probability = "Probability to be used as exit node"; +L10n.bandwidth = "Bandwidth"; +L10n.nos_oignons = "Nos oignons"; +L10n.others = "Others"; +L10n.t_3_days = "3 days"; +L10n.t_1_week = "1 week"; +L10n.t_1_month = "1 month"; +L10n.t_3_months = "3 months"; +L10n.t_1_year = "1 year"; diff --git a/assets/l10n.fr.js b/assets/l10n.fr.js new file mode 100644 index 0000000..0e948d5 --- /dev/null +++ b/assets/l10n.fr.js @@ -0,0 +1,12 @@ +function L10n() { }; +L10n.loading = "Chargement…"; +L10n.consensus_weight = "Poid dans l'ensemble du réseau"; +L10n.exit_probability = "Probabilité d'être utilisé comme nœud de sortie"; +L10n.bandwidth = "Bande passante"; +L10n.nos_oignons = "Nos oignons"; +L10n.others = "Autres"; +L10n.t_3_days = "3 jours"; +L10n.t_1_week = "1 semaine"; +L10n.t_1_month = "1 mois"; +L10n.t_3_months = "3 mois"; +L10n.t_1_year = "1 an"; diff --git a/assets/pie_graphs.js b/assets/pie_graphs.js new file mode 100644 index 0000000..e607fa5 --- /dev/null +++ b/assets/pie_graphs.js @@ -0,0 +1,94 @@ +function PieDrawer(selector) { + this.selector = selector; +}; +PieDrawer.width = 150; +PieDrawer.height = 150; +PieDrawer.radius = Math.min(PieDrawer.width, PieDrawer.height) / 2; +PieDrawer.formatPercent = d3.format(".2%"); + +PieDrawer.color_nos_oignons = "#ffa430"; +PieDrawer.color_others = "#57075f"; + +PieDrawer.arc = d3.svg.arc() + .outerRadius(PieDrawer.radius - 10) + .innerRadius(PieDrawer.radius - 40); + +PieDrawer.labelRadius = PieDrawer.radius - 15; + +PieDrawer.pie = d3.layout.pie() + .sort(null) + .value(function(d) { return d.frac; }); + +PieDrawer.onionoo_url = "https://onionoo.torproject.org/details?type=relay&contact=adminsys@nos-oignons.net"; + +PieDrawer.prototype.getFieldName = undefined; +PieDrawer.prototype.getField = undefined; +PieDrawer.prototype.draw = function() { + var svg = d3.select(this.selector).append("svg") + .style("margin", "auto") + .attr("width", PieDrawer.width) + .attr("height", PieDrawer.height) + .append("g") + .attr("transform", "translate(" + PieDrawer.width / 2 + "," + PieDrawer.height / 2 + ")"); + + var text = svg.append("text") + .attr("text-anchor", "middle") + .attr("dy", ".35em") + .text(L10n.loading); + + var field_getter = this.getField; + d3.json(PieDrawer.onionoo_url + "&fields=fingerprint," + this.getFieldName(), function(error, raw_data) { + var frac_nos_oignons = 0; + raw_data['relays'].forEach(function(d) { + nos_oignons_relays.forEach(function(r) { + if (r.fingerprint == d.fingerprint) { + var value = field_getter(d); + if (value) { + frac_nos_oignons += value; + } + } + }); + }); + var frac_others = 1 - frac_nos_oignons; + + data = [ { name: L10n.nos_oignons, frac: frac_nos_oignons, color: PieDrawer.color_nos_oignons, }, + { name: L10n.others, frac: frac_others, color: PieDrawer.color_others }, ]; + + text.text(PieDrawer.formatPercent(data[0].frac)); + + var g = svg.selectAll(".arc") + .data(PieDrawer.pie(data)) + .enter().append("g") + .attr("class", "arc"); + + g.append("path") + .attr("d", PieDrawer.arc) + .style("fill", function(d) { return d.data.color; }); + + }); +} + +function ConsensusPieDrawer(selector) { + this.selector = selector; +}; +ConsensusPieDrawer.prototype = new PieDrawer(); +ConsensusPieDrawer.prototype.getSelector = function() { + return "#consensus-pie"; +}; +ConsensusPieDrawer.prototype.getFieldName = function() { + return "consensus_weight_fraction"; +}; +ConsensusPieDrawer.prototype.getField = function(r) { + return r.consensus_weight_fraction; +}; + +function ExitPieDrawer(selector) { + this.selector = selector; +}; +ExitPieDrawer.prototype = new PieDrawer(); +ExitPieDrawer.prototype.getFieldName = function() { + return "exit_probability"; +}; +ExitPieDrawer.prototype.getField = function(r) { + return r.exit_probability; +}; -- 2.39.5