Very nice, but this is more of a demo code for boost::asio than something that is production-worthy.<p>For example, it doesn't relay FINs between connections, doesn't disable Nagle algorithm on the upstream socket, doesn't wait for pending writes to complete before tearing down the connection, doesn't handle congestion at all (potentially leading to unbound memory use), etc.
As someone who has also written a TCP proxy (along with <i>many</i> others...), after thoroughly reading the page I'm still unsure of how exactly this is "high performance". It is also curious that, despite the fact that it uses a separate library for networking, the source is already quite a bit longer than some other proxies which don't. I found the explanation overly complex.<p>Around half the code in this implementation could probably be removed by the realisation that, after a connection is established, both ends are completely symmetric: all it needs to do is try to read from A and write to B, then try to read from B and write to A. If A closes, close B. If B closes, close A.
As a sidenote if you don't have a requirement to compile with C++03 I would recommend using the standalone asio library free from boost[1]. The only things you need to modify are the includes and namespaces.<p>[1] <a href="http://think-async.com/Asio/Download" rel="nofollow">http://think-async.com/Asio/Download</a>
A similar application that I'm fond of is Pen, which also does simple load balancing and has udp support:<p><a href="http://siag.nu/pen/" rel="nofollow">http://siag.nu/pen/</a>
If it meets the guidelines, this might make a good 'Show HN'. Show HN guidelines: <a href="https://news.ycombinator.com/showhn.html" rel="nofollow">https://news.ycombinator.com/showhn.html</a>