I am writing a modular multi-protocol proxy (initially for HTTP, and later HTTPS and possibly FTP as well) using Twisted. It will consist of a small core that handles initialization and loading of modules, a module for each protocol (which will consist of a part that accepts connections and a part that connects to the remote server), and several "filter" modules (which will be inserted in a "stack" between the two halves of the protocol module) for things like caching and filtering. Would there be a better way to structure it? Would the best way to handle the modules be to write a ServerFactory subclass that wraps the stack of modules? I understand the basic concepts behind Twisted, but am not totally familiar with the API, so I am not exactly sure what is the best way to do things.