[tor-commits] [sbws/master] fix: doc: Add relay measure activity diagram

juga at torproject.org juga at torproject.org
Tue Feb 23 07:24:15 UTC 2021


commit 78c4091538493604e2d9749bc0e93bbb968d0b1a
Author: juga0 <juga at riseup.net>
Date:   Wed Feb 3 12:05:49 2021 +0000

    fix: doc: Add relay measure activity diagram
---
 docs/source/activity_measure.puml       | 30 +++++++++++++++++++++++
 docs/source/how_works.rst               | 12 +++++++++-
 docs/source/images/activity_measure.svg | 42 +++++++++++++++++++++++++++++++++
 3 files changed, 83 insertions(+), 1 deletion(-)

diff --git a/docs/source/activity_measure.puml b/docs/source/activity_measure.puml
new file mode 100644
index 0000000..f553cb1
--- /dev/null
+++ b/docs/source/activity_measure.puml
@@ -0,0 +1,30 @@
+ at startuml
+
+start
+
+if (exit?) then (yes)
+  :[h, r];
+else (no)
+  :[r, h];
+endif
+if (circuit?) then (yes)
+    :stream;
+    if (no stream and [h, r]) then (yes)
+        :[r, h] (r is exit);
+        if (circuit?) then (yes)
+            :stream;
+        else (no)
+            :WARN;
+            :ErrorCircuit;
+        endif
+    endif
+    if (no stream) then (yes)
+        :ErrorStream;
+    endif
+else (no)
+    :ErrorCircuit;
+endif
+
+stop
+
+ at enduml
diff --git a/docs/source/how_works.rst b/docs/source/how_works.rst
index 24f8689..f4b1ae0 100644
--- a/docs/source/how_works.rst
+++ b/docs/source/how_works.rst
@@ -73,6 +73,16 @@ Measuring relays
 
 Source code: :func:`sbws.core.scanner.measure_relay`
 
+Measuring a relay
+~~~~~~~~~~~~~~~~~
+
+.. image:: ./images/activity_measure.svg
+   :alt: activity measuring a relay
+   :height: 300px
+   :align: center
+
+Source code: :func:`sbws.core.scanner.measure_relay`
+
 Selecting a second relay
 ~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -165,4 +175,4 @@ The bandwidth file format is defined in the bandwidth_file_spec_.
 .. _requests: http://docs.python-requests.org/
 .. _peerflow: https://www.nrl.navy.mil/itd/chacs/sites/www.nrl.navy.mil.itd.chacs/files/pdfs/16-1231-4353.pdf
 .. _torflow_scaling: https://gitweb.torproject.org/torflow.git/tree/NetworkScanners/BwAuthority/README.spec.txt#n298
-.. _bandwidth_file_spec: https://gitweb.torproject.org/torspec.git/tree/bandwidth-file-spec.txt
\ No newline at end of file
+.. _bandwidth_file_spec: https://gitweb.torproject.org/torspec.git/tree/bandwidth-file-spec.txt
diff --git a/docs/source/images/activity_measure.svg b/docs/source/images/activity_measure.svg
new file mode 100644
index 0000000..a278ce7
--- /dev/null
+++ b/docs/source/images/activity_measure.svg
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="783px" preserveAspectRatio="none" style="width:337px;height:783px;" version="1.1" viewBox="0 0 337 783" width="337px" zoomAndPan="magnify"><defs><filter height="300%" id="fhkta1jkgebqi" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><ellipse cx="185.75" cy="20" fill="#000000" filter="url(#fhkta1jkgebqi)" rx="10" ry="10" style="stroke: none; stroke-width: 1.0;"/><polygon fill="#FEFECE" filter="url(#fhkta1jkgebqi)" points="172.75,50,198.75,50,210.75,62,198.75,74,172.75,74,160.75,62,172.75,50" sty
 le="stroke: #A80036; stroke-width: 1.5;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="26" x="172.75" y="65.8081">exit?</text><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="20" x="140.75" y="59.4058">yes</text><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="14" x="210.75" y="59.4058">no</text><rect fill="#FEFECE" filter="url(#fhkta1jkgebqi)" height="33.9688" rx="12.5" ry="12.5" style="stroke: #A80036; stroke-width: 1.5;" width="51" x="124.75" y="84"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="31" x="134.75" y="105.1387">[h, r]</text><rect fill="#FEFECE" filter="url(#fhkta1jkgebqi)" height="33.9688" rx="12.5" ry="12.5" style="stroke: #A80036; stroke-width: 1.5;" width="51" x="195.75" y="84"/><text fill="#000000" font-family="sans-serif" font-size="12"
  lengthAdjust="spacingAndGlyphs" textLength="31" x="205.75" y="105.1387">[r, h]</text><polygon fill="#FEFECE" filter="url(#fhkta1jkgebqi)" points="185.75,123.9688,197.75,135.9688,185.75,147.9688,173.75,135.9688,185.75,123.9688" style="stroke: #A80036; stroke-width: 1.5;"/><polygon fill="#FEFECE" filter="url(#fhkta1jkgebqi)" points="165.75,167.9688,205.75,167.9688,217.75,179.9688,205.75,191.9688,165.75,191.9688,153.75,179.9688,165.75,167.9688" style="stroke: #A80036; stroke-width: 1.5;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="40" x="165.75" y="183.7769">circuit?</text><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="20" x="133.75" y="177.3745">yes</text><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="14" x="217.75" y="177.3745">no</text><rect fill="#FEFECE" filter="url(#fhkta1jkgebqi)" height="33.9688" rx="1
 2.5" ry="12.5" style="stroke: #A80036; stroke-width: 1.5;" width="64" x="58.5" y="201.9688"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="44" x="68.5" y="223.1074">stream</text><rect fill="#FEFECE" filter="url(#fhkta1jkgebqi)" height="33.9688" rx="12.5" ry="12.5" style="stroke: #A80036; stroke-width: 1.5;" width="110" x="35.5" y="304.3398"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="90" x="45.5" y="325.4785">[r, h] (r is exit)</text><polygon fill="#FEFECE" filter="url(#fhkta1jkgebqi)" points="70.5,358.3086,110.5,358.3086,122.5,370.3086,110.5,382.3086,70.5,382.3086,58.5,370.3086,70.5,358.3086" style="stroke: #A80036; stroke-width: 1.5;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="40" x="70.5" y="374.1167">circuit?</text><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAn
 dGlyphs" textLength="20" x="38.5" y="367.7144">yes</text><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="14" x="122.5" y="367.7144">no</text><rect fill="#FEFECE" filter="url(#fhkta1jkgebqi)" height="33.9688" rx="12.5" ry="12.5" style="stroke: #A80036; stroke-width: 1.5;" width="64" x="10" y="392.3086"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="44" x="20" y="413.4473">stream</text><rect fill="#FEFECE" filter="url(#fhkta1jkgebqi)" height="33.9688" rx="12.5" ry="12.5" style="stroke: #A80036; stroke-width: 1.5;" width="56" x="111" y="392.3086"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="36" x="121" y="413.4473">WARN</text><rect fill="#FEFECE" filter="url(#fhkta1jkgebqi)" height="33.9688" rx="12.5" ry="12.5" style="stroke: #A80036; stroke-width: 1.5;" width="90" x="94" y="446.2773"/><text fill="#000000" font-
 family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="70" x="104" y="467.416">ErrorCircuit</text><polygon fill="#FEFECE" filter="url(#fhkta1jkgebqi)" points="90.5,486.2461,102.5,498.2461,90.5,510.2461,78.5,498.2461,90.5,486.2461" style="stroke: #A80036; stroke-width: 1.5;"/><polygon fill="#FEFECE" filter="url(#fhkta1jkgebqi)" points="32.5,255.9375,148.5,255.9375,160.5,267.9375,148.5,279.9375,32.5,279.9375,20.5,267.9375,32.5,255.9375" style="stroke: #A80036; stroke-width: 1.5;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="20" x="94.5" y="290.1479">yes</text><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="116" x="32.5" y="271.7456">no stream and [h, r]</text><polygon fill="#FEFECE" filter="url(#fhkta1jkgebqi)" points="90.5,530.2461,102.5,542.2461,90.5,554.2461,78.5,542.2461,90.5,530.2461" style="stroke: #A80036; stroke-width: 1.5;"/><rect fill=
 "#FEFECE" filter="url(#fhkta1jkgebqi)" height="33.9688" rx="12.5" ry="12.5" style="stroke: #A80036; stroke-width: 1.5;" width="96" x="42.5" y="622.6484"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="76" x="52.5" y="643.7871">ErrorStream</text><polygon fill="#FEFECE" filter="url(#fhkta1jkgebqi)" points="61,574.2461,120,574.2461,132,586.2461,120,598.2461,61,598.2461,49,586.2461,61,574.2461" style="stroke: #A80036; stroke-width: 1.5;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="20" x="94.5" y="608.4565">yes</text><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="59" x="61" y="590.0542">no stream</text><polygon fill="#FEFECE" filter="url(#fhkta1jkgebqi)" points="90.5,676.6172,102.5,688.6172,90.5,700.6172,78.5,688.6172,90.5,676.6172" style="stroke: #A80036; stroke-width: 1.5;"/><rect fill="#FEFECE" filter="url(#fh
 kta1jkgebqi)" height="33.9688" rx="12.5" ry="12.5" style="stroke: #A80036; stroke-width: 1.5;" width="90" x="236" y="201.9688"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="70" x="246" y="223.1074">ErrorCircuit</text><polygon fill="#FEFECE" filter="url(#fhkta1jkgebqi)" points="185.75,706.6172,197.75,718.6172,185.75,730.6172,173.75,718.6172,185.75,706.6172" style="stroke: #A80036; stroke-width: 1.5;"/><ellipse cx="185.75" cy="761.6172" fill="#FFFFFF" filter="url(#fhkta1jkgebqi)" rx="11" ry="11" style="stroke: #000000; stroke-width: 1.0;"/><ellipse cx="185.75" cy="761.6172" fill="#000000" rx="6" ry="6" style="stroke: #7F7F7F; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="160.75" x2="150.25" y1="62" y2="62"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="150.25" x2="150.25" y1="62" y2="84"/><polygon fill="#A80036" points="146.25,74,150.25,84,154.25,74,150.25,78" style="stroke: #A80036; strok
 e-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="210.75" x2="221.25" y1="62" y2="62"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="221.25" x2="221.25" y1="62" y2="84"/><polygon fill="#A80036" points="217.25,74,221.25,84,225.25,74,221.25,78" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="150.25" x2="150.25" y1="117.9688" y2="135.9688"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="150.25" x2="173.75" y1="135.9688" y2="135.9688"/><polygon fill="#A80036" points="163.75,131.9688,173.75,135.9688,163.75,139.9688,167.75,135.9688" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="221.25" x2="221.25" y1="117.9688" y2="135.9688"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="221.25" x2="197.75" y1="135.9688" y2="135.9688"/><polygon fill="#A80036" points="207.75,131.9688,197.75,135.9688,207.75,139.9688,203.75,135.9688" style="stroke: #A80036; stroke
 -width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="185.75" x2="185.75" y1="30" y2="50"/><polygon fill="#A80036" points="181.75,40,185.75,50,189.75,40,185.75,44" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="139" x2="139" y1="426.2773" y2="446.2773"/><polygon fill="#A80036" points="135,436.2773,139,446.2773,143,436.2773,139,440.2773" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="58.5" x2="42" y1="370.3086" y2="370.3086"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="42" x2="42" y1="370.3086" y2="392.3086"/><polygon fill="#A80036" points="38,382.3086,42,392.3086,46,382.3086,42,386.3086" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="122.5" x2="139" y1="370.3086" y2="370.3086"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="139" x2="139" y1="370.3086" y2="392.3086"/><polygon fill="#A80036" points="
 135,382.3086,139,392.3086,143,382.3086,139,386.3086" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="42" x2="42" y1="426.2773" y2="498.2461"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="42" x2="78.5" y1="498.2461" y2="498.2461"/><polygon fill="#A80036" points="68.5,494.2461,78.5,498.2461,68.5,502.2461,72.5,498.2461" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="139" x2="139" y1="480.2461" y2="498.2461"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="139" x2="102.5" y1="498.2461" y2="498.2461"/><polygon fill="#A80036" points="112.5,494.2461,102.5,498.2461,112.5,502.2461,108.5,498.2461" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="90.5" x2="90.5" y1="338.3086" y2="358.3086"/><polygon fill="#A80036" points="86.5,348.3086,90.5,358.3086,94.5,348.3086,90.5,352.3086" style="stroke: #A80036; stroke-width: 1.0;"/><line 
 style="stroke: #A80036; stroke-width: 1.5;" x1="90.5" x2="90.5" y1="279.9375" y2="304.3398"/><polygon fill="#A80036" points="86.5,294.3398,90.5,304.3398,94.5,294.3398,90.5,298.3398" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="160.5" x2="204" y1="267.9375" y2="267.9375"/><polygon fill="#A80036" points="200,397.293,204,407.293,208,397.293,204,401.293" style="stroke: #A80036; stroke-width: 1.5;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="204" x2="204" y1="267.9375" y2="542.2461"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="204" x2="102.5" y1="542.2461" y2="542.2461"/><polygon fill="#A80036" points="112.5,538.2461,102.5,542.2461,112.5,546.2461,108.5,542.2461" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="90.5" x2="90.5" y1="510.2461" y2="530.2461"/><polygon fill="#A80036" points="86.5,520.2461,90.5,530.2461,94.5,520.2461,90.5,524.2461" style="stroke: #A80036;
  stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="90.5" x2="90.5" y1="235.9375" y2="255.9375"/><polygon fill="#A80036" points="86.5,245.9375,90.5,255.9375,94.5,245.9375,90.5,249.9375" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="90.5" x2="90.5" y1="598.2461" y2="622.6484"/><polygon fill="#A80036" points="86.5,612.6484,90.5,622.6484,94.5,612.6484,90.5,616.6484" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="132" x2="148.5" y1="586.2461" y2="586.2461"/><polygon fill="#A80036" points="144.5,629.6328,148.5,639.6328,152.5,629.6328,148.5,633.6328" style="stroke: #A80036; stroke-width: 1.5;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="148.5" x2="148.5" y1="586.2461" y2="688.6172"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="148.5" x2="102.5" y1="688.6172" y2="688.6172"/><polygon fill="#A80036" points="112.5,684.6172,102.5,688.6172,112.5,69
 2.6172,108.5,688.6172" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="90.5" x2="90.5" y1="656.6172" y2="676.6172"/><polygon fill="#A80036" points="86.5,666.6172,90.5,676.6172,94.5,666.6172,90.5,670.6172" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="90.5" x2="90.5" y1="554.2461" y2="574.2461"/><polygon fill="#A80036" points="86.5,564.2461,90.5,574.2461,94.5,564.2461,90.5,568.2461" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="153.75" x2="90.5" y1="179.9688" y2="179.9688"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="90.5" x2="90.5" y1="179.9688" y2="201.9688"/><polygon fill="#A80036" points="86.5,191.9688,90.5,201.9688,94.5,191.9688,90.5,195.9688" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="217.75" x2="281" y1="179.9688" y2="179.9688"/><line style="stroke: #A80036;
  stroke-width: 1.5;" x1="281" x2="281" y1="179.9688" y2="201.9688"/><polygon fill="#A80036" points="277,191.9688,281,201.9688,285,191.9688,281,195.9688" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="90.5" x2="90.5" y1="700.6172" y2="718.6172"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="90.5" x2="173.75" y1="718.6172" y2="718.6172"/><polygon fill="#A80036" points="163.75,714.6172,173.75,718.6172,163.75,722.6172,167.75,718.6172" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="281" x2="281" y1="235.9375" y2="718.6172"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="281" x2="197.75" y1="718.6172" y2="718.6172"/><polygon fill="#A80036" points="207.75,714.6172,197.75,718.6172,207.75,722.6172,203.75,718.6172" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="185.75" x2="185.75" y1="147.9688" y2="167.9688"/><polygon fill="
 #A80036" points="181.75,157.9688,185.75,167.9688,189.75,157.9688,185.75,161.9688" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="185.75" x2="185.75" y1="730.6172" y2="750.6172"/><polygon fill="#A80036" points="181.75,740.6172,185.75,750.6172,189.75,740.6172,185.75,744.6172" style="stroke: #A80036; stroke-width: 1.0;"/><!--MD5=[0038797c84fdfaab99117ed27ea6346a]
+ at startuml
+
+start
+
+if (exit?) then (yes)
+  :[h, r];
+else (no)
+  :[r, h];
+endif
+if (circuit?) then (yes)
+    :stream;
+    if (no stream and [h, r]) then (yes)
+        :[r, h] (r is exit);
+        if (circuit?) then (yes)
+            :stream;
+        else (no)
+            :WARN;
+            :ErrorCircuit;
+        endif
+    endif
+    if (no stream) then (yes)
+        :ErrorStream;
+    endif
+else (no)
+    :ErrorCircuit;
+endif
+
+stop
+
+ at enduml
+
+PlantUML version 1.2020.02(Sun Mar 01 10:22:07 GMT 2020)
+(GPL source distribution)
+Java Runtime: Java(TM) SE Runtime Environment
+JVM: Java HotSpot(TM) 64-Bit Server VM
+Java Version: 1.8.0_241-b07
+Operating System: Linux
+Default Encoding: UTF-8
+Language: en
+Country: US
+--></g></svg>
\ No newline at end of file





More information about the tor-commits mailing list