refactor of Tunnel() for unit testing; create unit tests for Tunnel()

This commit is contained in:
Mike Kinney
2021-12-30 21:24:32 -08:00
parent 3f307880f9
commit d366e74e86
7 changed files with 205 additions and 122 deletions

View File

@@ -210,3 +210,18 @@ def remove_keys_from_dict(keys, adict):
if key in adict:
del newdict[key]
return newdict
def hexstr(barray):
"""Print a string of hex digits"""
return ":".join('{:02x}'.format(x) for x in barray)
def ipstr(barray):
"""Print a string of ip digits"""
return ".".join('{}'.format(x) for x in barray)
def readnet_u16(p, offset):
"""Read big endian u16 (network byte order)"""
return p[offset] * 256 + p[offset + 1]