Create an ezpt pluggable transports wrapper
There should be a program that is a managed-transport wrapper: it understands pt environment variables, has a SOCKS listener, and forks a command of your choice to transform input to output and vice versa. For example,
ezpt -m rot13 'tr "[a-zA-Z]" "[n-za-mN-ZA-M]"'
ezpt -m xor255 "perl -e '$|=1;while(read(STDIN,$_,1)){print chr(ord^0xff);}'"
ezpt -m double "perl -e '$|=1;while(read(STDIN,$_,1)){print "$_$_";}'" "perl -e '$|=1;while(read(STDIN,$_,2)){print chop;}'"
If one command is given, the same command is used for encoding and decoding. If two commands are given, one is used for encoding and one is used for decoding. -m
gives the method name.
Use in torrc
:
ClientTransportPlugin rot13 exec ezpt -m rot13 'tr "[a-zA-Z]" "[n-za-mN-Za-M]"'
ServerTransportPlugin rot13 exec ezpt -m rot13 'tr "[a-zA-Z]" "[n-za-mN-Za-M]"'
Invoked subprograms may need to always flush their buffers to prevent deadlock; that's their problem. (That's what the $|=1
does in Perl.)