What additional functionality does this provide over just using Tor's built in transparent proxy functionality, which you can use by just turning on the DNSPort and TransPort options in Tor and redirecting traffic using iptables, skipping any need for socks.
Also, the Tor project highly discourages this kind of use of its network as per the disclaimer at the top of https://trac.torproject.org/projects/tor/wiki/doc/Transparen... - Is it worth adding a similar disclaimer to this project?