[tor-commits] [bridgedb/master] Port create_descriptors script to Python 3.
phw at torproject.org
phw at torproject.org
Wed Feb 19 18:26:38 UTC 2020
commit 66cdfa6c6e31759f4b56b98aec27be860c5b1dad
Author: Philipp Winter <phw at nymity.ch>
Date: Mon Jan 27 16:22:21 2020 -0800
Port create_descriptors script to Python 3.
...all this required was replacing the ipaddr module with ipaddress.
---
scripts/create_descriptors | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/create_descriptors b/scripts/create_descriptors
index ab6ea2e..0b9d26d 100755
--- a/scripts/create_descriptors
+++ b/scripts/create_descriptors
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.7
+#!/usr/bin/env python3
#
# This file is part of BridgeDB, a Tor bridge distribution system.
@@ -6,7 +6,7 @@ import os
import random
import sys
import time
-import ipaddr
+import ipaddress
import math
import argparse
import hashlib
@@ -120,7 +120,7 @@ def get_hex_string(size):
def get_random_ipv6_addr():
valid_addr = None
while not valid_addr:
- maybe = ipaddr.IPv6Address(random.getrandbits(128))
+ maybe = ipaddress.IPv6Address(random.getrandbits(128))
valid = check_ip_validity(maybe)
if valid:
valid_addr = maybe
More information about the tor-commits
mailing list