[Twisted-Python] Best way to write a modularized proxy?

L. Daniel Burr ldanielburr at mac.com
Wed Aug 15 06:55:30 EDT 2007

Hi Andrew,

On Wed, 15 Aug 2007 05:13:16 -0500, Andrew Warkentin  
<andreww at datanet.ab.ca> wrote:

> 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?

Replace the word "module" with IService, and I think your design seems

> 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.

I'd write an IService implementation for each type of proxy I wanted
to deploy, hang them all off of a MultiService, and go from there.

Hope this helps,

L. Daniel Burr

More information about the Twisted-Python mailing list