port of ziproxy with some modifications