[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A lovely 2 tier effect



On Mon, 2003-02-03 at 17:02, Tim Haughton wrote:
 [...]
> What is the possibility of implementing mixminion in a two tier fashion?
> Putting all the intelligence in a dynamic link library, and then
> implementing the CLI seperately. This gives the advantage that other
> projects that are consumers of Mixminion can import the functions in the
> library, rather than having to pipe commands to a command line tool.

I think that's more or less what we have; all the functionality is
implemented as Python classes and modules that any program can import. 
I can send a message to myself from the Python command line interpreter
like this:

export PYTHONPATH=~/lib/python2.2/site-packages
python2.2
>>> import mixminion.ClientMain as CM
>>> from mixminion.Config import ClientConfig
>>> config = ClientConfig("/home/nickm/.mixminionrc")
>>> client = CM.MixminionClient(config)
>>> serverList = CM.ClientKeystore("/home/nickm/.mixminion")
>>> address = CM.parseAddress("nickm@freehaven.net")
>>> leg1, leg2 = CM.parsePath(serverList, config, "totoro1,moria2:cf,tonga", address)
>>> message = "Hello there! Testing 1 2 3"
>>> client.sendForwardMessage(address, message, leg1, leg2)

The code is fairly well commented, and all functions and classes should
have good documentation.  Let me know if you have any questions about
them.
======================
Of course, for this to work, you'll need to write in Python, or embed a
Python interpreter in your application.  This is fairly easy --
especially if you're using a good wrapper like Boost.Python (see
http://www.boost.org/libs/python/doc/) -- and (again) I'd be happy to
help, but if you'd rather not require Python, you'll have to wait for a
pure-C or pure-C++ type-III remailer implementation.

(Or, somebody could port Mixminion to Jython... but I'm not holding my
breath.)

Hope this helps,
-- 
Nick Mathewson <nickm@alum.mit.edu>