Port re6stnet to python3
This PR contains the changes necessary to make re6stnet work under Python 3.11. These changes are breaking regarding Python 2 compatibility.
Logs have been added to make debugging easier, and the code has been hardened through use of assert(...)
in multiple locations to ensure fail-fast behavior in case of unreachable code or violations of code invariants.
Notable changes:
- the
cryptography
module should be used for future development. Usages of thepyOpenSSL
module are still present in there6st.x509
module but should be replaced accordingly in the long run. - resources (sockets, file descriptors) are now properly cleaned up after use
- Python 3 added automatic detection of leaked resources, which highlighted a lot of usages of such resources where they weren't freed or deallocated. For a long-running program such as re6stnet this can be problematic.
-
type annotations have been added all throughout the codebase to allow for easier inspection and debugging. The highly dynamic nature of certain components (e.g. registry RPC), and the recurrent usage of string literals (e.g.
"udp"
,"udp6"
) make it quite difficult to properly annotate everything, so this is a best-effort approach.- Type annotations and enums should be used as much as possible for future code.
- the
fixnemu.py
file, containing various patches and fixes for nemu (mostly related to changes in parsing textual output fromiproute2
) has been removed since the patches have been upstreamed to nemu3