This is where I’m developing a new proxy, which will eventually be able to support multiple rabbits and be able to either offer them services itself OR transparently pass on the request to the Violet service.
It needs an Apache config similar to this (to make it proxy on port 4453):
Listen 4453
NameVirtualHost *:4453
<VirtualHost *:4453>
ServerName rivendell.local
DocumentRoot /home/nabaztag/
<Directory /home/nabaztag/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
RewriteEngine On
RewriteRule .* /home/nabaztag/proxy.php/$0
ErrorLog /home/nabaztag/error.log
LogLevel warn
CustomLog /home/nabaztag/access.log combined
</VirtualHost>
The code itself is in these tarfiles (I’ll add more as I update the code) - feel free to email me about it at nabaztag@magicmonkey.org:
STOP PRESS: I’ve realised that the DB-driven version is kinda awkward to work with from a playing around point of view, so I’ve got a much simpler version which I’ll post up here soon. The assembler is still the same, though, as it appears to work pretty well.
This version does away with the nasty MD5-hashing to decide whether to re-deliver the firmware, and instead it uses the ID numbers from the URL like how Violet do. Much nicer. Sadly, this needs a database schema change, which is reflected in the create.sql file.
Another quick point release: I’ve added a bunch of comments, to try to make the code easier to understand. I’ve also realised that the whole way I’m caching the last response by using a hash of the firmware is really really bad, and I should use the tc/tn GET parameters like how Violet do. Back to the drawing board...
Quick point release: I’ve added a service which proxies the Violet service. Just switch which service your rabbit uses in the rabbit_service table (I must make a web frontend for that...)
This version fully relies on the database, and has a concept of “services” which the rabbit can be using. Currently it only allows one service at a time, I’m not yet sure how multiple services are going to work.
For this version, when your rabbit gets an entry into the “rabbits” table, you need to add a row to the rabbit_service table to link your rabbit with a particular service. The tarball includes a “clockface” service, which just puts lights on according to what time it is (changes every 20 mins). If you want debug info, you need to make sure that the webserver can write to a file called “debug.log” in the proxy’s directory.
It needs a file called “program.hex” in the same directory, which is an assembled program file (you can use My assembler to create this). It also needs to be able to write a file called hash.firmware, to figure out whether to re-send the firmware. The naz_rabbit::getSrc() method is currently setup to respond properly for the Clockface program; I plan to create a library of services, and remember which rabbit is running which services, so that the getSrc() method can respond apropriately.
This script logs requests to a MySQL database (made using the create.sql script which is in the tarfile); if you want to disable this, then just set the log_to_db flag to “false” in the config.php file (this file is also where you set the DB access credentials).