WARNING: this has absolutely NO safety measures in place. Data is transmitted and stored as UTF-8 plain text, including passwords. Please, don't use this.
This is a homegrown plain text editor working in a client-server configuration. The protocol is based on bare TCP and quite rudimentary.
It makes use of Python's ability to deconstruct objects into dictionaries, which can then be serialized into JSON strings and sent via a TCP connection. Upon receiving the message can be reconstructed into an object, making it clear which attributes a message should and should not possess.
Each functionality has its own
Request object, with the servers possible
Response types specified in its docstring.
Messages are sent over TCP with a 2-byte proto-header, which specifies the length of the JSON message. The
entire payload is pictured below.
2 bytes of message length as 16-bit unsigned integer in "big indian" byteorder │ ▼ ┌─────────┬──────────────────────────────────────────────────┐ │ ███████ │ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ │ └─────────┴──────────────────────────────────────────────────┘ ▲ │ JSON message encoded with UTF-8
Note that the 2-byte size of message length header limits the JSON size to ~65MB.
transfer.py module provides helper functions for sending and receiving messages in the manner described