commit 770082bfee89c9c02945fa5e1a1c34fc69b9ce5c Author: Karsten Loesing karsten.loesing@gmx.net Date: Wed Aug 5 22:38:39 2020 +0200
Update criteria for partial/full IPv6 support. --- tpo-metrics-trac-40002/TESTS.txt | 55 ++++++++++++++++++++++++++++++++++++++++ tpo-metrics-trac-40002/ipv6.py | 4 +-- 2 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/tpo-metrics-trac-40002/TESTS.txt b/tpo-metrics-trac-40002/TESTS.txt new file mode 100644 index 0000000..f66646d --- /dev/null +++ b/tpo-metrics-trac-40002/TESTS.txt @@ -0,0 +1,55 @@ +# count relays +grep -c "^r " 2020-07-01-01-00-00-consensus + +# count relays with IPv6 ORPort +grep -c "^a [" 2020-07-01-01-00-00-consensus + +# compute total consensus weight +grep "^w " 2020-07-01-01-00-00-consensus | cut -d"=" -f2 | awk '{s+=$1}END{print s}' + +# compute consensus weight of relays with IPv6 ORPort +grep -A5 "^a [" 2020-07-01-01-00-00-consensus | grep "^w " | cut -d"=" -f2 | awk '{s+=$1}END{print s}' + +# count relays with IPv6 ORPort and partial IPv6 reachability checks +grep -A5 "^a [" 2020-07-01-01-00-00-consensus | grep "^v Tor 0.4.4.[1-9]" | sort | uniq -c + +# count relays with IPv6 ORPort and full IPv6 reachability checks +grep -A5 "^a [" 2020-07-01-01-00-00-consensus | grep -B1 "^pr.* Relay=..3" | grep "^v Tor 0.4.5" | sort | uniq -c + +# compute consensus weight of relays with IPv6 ORPort and partial IPv6 reachability checks +grep -A5 "^a [" 2020-07-01-01-00-00-consensus | grep -A2 "^v Tor 0.4.4.[1-9]" | grep "^w " | cut -d"=" -f2 | awk '{s+=$1}END{print s}' + +# compute consensus weight of relays with IPv6 ORPort and full IPv6 reachability checks +grep -A5 "^a [" 2020-07-01-01-00-00-consensus | grep -C1 "^pr.* Relay=..3" | grep -A2 "^v Tor 0.4.5" | grep "^w " | cut -d"=" -f2 | awk '{s+=$1}END{print s}' + +# obtain subset of usable guards +grep -v "^s.* Exit" 2020-07-01-01-00-00-consensus | grep -B2 -A4 "^s.* Guard" > 2020-07-01-01-00-00-usable-guards +grep -B2 -A4 "^s.* BadExit.* Guard" 2020-07-01-01-00-00-consensus >> 2020-07-01-01-00-00-usable-guards + +# count usable guards +grep -c "^r " 2020-07-01-01-00-00-usable-guards + +# find Wgd value +grep Wgd 2020-07-01-01-00-00-consensus + +# count usable guards with IPv6 ORPort +grep -c "^a [" 2020-07-01-01-00-00-usable-guards + +# compute usable guards consensus weight +grep "^w " 2020-07-01-01-00-00-usable-guards | cut -d"=" -f2 | awk '{s+=$1}END{print s}' + +# compute consensus weight of usable guards with IPv6 ORPort +grep -A5 "^a [" 2020-07-01-01-00-00-usable-guards | grep "^w " | cut -d"=" -f2 | awk '{s+=$1}END{print s}' + +# count usable guards with IPv6 ORPort and partial IPv6 reachability checks +grep -A5 "^a [" 2020-07-01-01-00-00-usable-guards | grep "^v Tor 0.4.4.[1-9]" | sort | uniq -c + +# count usable guards with IPv6 ORPort and full IPv6 reachability checks +grep -A5 "^a [" 2020-07-01-01-00-00-usable-guards | grep -C1 "^pr.* Relay=..3" | grep "^v Tor 0.4.5" | sort | uniq -c + +# compute consensus weight of usable guards with IPv6 ORPort and partial IPv6 reachability checks +grep -A5 "^a [" 2020-07-01-01-00-00-usable-guards | grep -A2 "^v Tor 0.4.4.[1-9]" | grep "^w " | cut -d"=" -f2 | awk '{s+=$1}END{print s}' + +# compute consensus weight of usable guards with IPv6 ORPort and full IPv6 reachability checks +grep -A5 "^a [" 2020-07-01-01-00-00-usable-guards | grep -C1 "^pr.* Relay=..3" | grep -A2 "^v Tor 0.4.5" | grep "^w " | cut -d"=" -f2 | awk '{s+=$1}END{print s}' + diff --git a/tpo-metrics-trac-40002/ipv6.py b/tpo-metrics-trac-40002/ipv6.py index 497ea26..286692b 100644 --- a/tpo-metrics-trac-40002/ipv6.py +++ b/tpo-metrics-trac-40002/ipv6.py @@ -78,7 +78,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import sys, stem, stem.version, stem.descriptor
-partial_support_version = stem.version.Version('0.4.4') +partial_support_version = stem.version.Version('0.4.4.1') full_support_version = stem.version.Version('0.4.5')
def read(consensus_filename): @@ -120,7 +120,7 @@ def read(consensus_filename): has_partial_support = False has_full_support = False if relay.version: - if relay.version >= full_support_version: + if "Relay" in relay.protocols and 3 in relay.protocols["Relay"] and relay.version >= full_support_version: has_full_support = True if relay.version >= partial_support_version: has_partial_support = True