|
@@ -1,6 +1,21 @@
|
|
|
|
|
|
|
|
|
import random
|
|
|
+from enum import Enum
|
|
|
+
|
|
|
+class WOMode(Enum):
|
|
|
+ """The different Walking Onion modes"""
|
|
|
+ VANILLA = 0
|
|
|
+ TELESCOPING = 1
|
|
|
+ SINGLEPASS = 2
|
|
|
+
|
|
|
+
|
|
|
+class SNIPAuthMode(Enum):
|
|
|
+ """The different styles of SNIP authentication"""
|
|
|
+ NONE = 0
|
|
|
+ MERKLE = 1
|
|
|
+ THRESHSIG = 2
|
|
|
+
|
|
|
|
|
|
class NetAddr:
|
|
|
"""A class representing a network address"""
|
|
@@ -26,13 +41,15 @@ class Network:
|
|
|
to the network, yielding a NetAddr (network address), and clients
|
|
|
can connect() to a NetAddr yielding a Connection."""
|
|
|
|
|
|
- def __init__(self):
|
|
|
+ def __init__(self, womode, snipauthmode):
|
|
|
self.servers = dict()
|
|
|
self.epoch = 1
|
|
|
self.epochcallbacks = []
|
|
|
self.epochendingcallbacks = []
|
|
|
self.dirauthkeylist = []
|
|
|
self.fallbackrelays = []
|
|
|
+ self.womode = womode
|
|
|
+ self.snipauthmode = snipauthmode
|
|
|
|
|
|
def printservers(self):
|
|
|
"""Print the list of NetAddrs bound to something."""
|
|
@@ -108,7 +125,7 @@ class Network:
|
|
|
return self.fallbackrelays
|
|
|
|
|
|
|
|
|
-thenetwork = Network()
|
|
|
+thenetwork = Network(WOMode.VANILLA, SNIPAuthMode.NONE)
|
|
|
|
|
|
|
|
|
random.seed(1)
|