公司服務(wù)器只有一臺訪問外網(wǎng),需要把對外網(wǎng)的一些tcp請求,轉(zhuǎn)發(fā)到這臺機(jī)器上,通過這臺機(jī)器的代理程序轉(zhuǎn)發(fā)到外網(wǎng)IP.
收集了一下tcp代理:
1.通過windows 帶的功能:
netsh interface portproxy add v4tov4 listenport=80 connectaddress=ip-of-server-on-internet connectport=23 listenaddress=ip-of-windows-machine protocol=tcp
2, C++ TCP Proxy Server
http://www.partow.net/programming/tcpproxy/index.html
有源碼異步IO.實用的庫:
http://think-async.com/Asio
https://github.com/chriskohlhoff/asio/
http://think-async.com/Asio/asio-1.11.0/doc/asio/tutorial.html
3.純linux c 實現(xiàn)代理,放在openwrt 中使用.
https://github.com/kklis/proxy
4.libevent帶的案例.window編譯需要注意,實用openssl的lib庫.
\libevent-2.0.22-stable\sample\le-proxy.c
5.windows 窗口消息實現(xiàn)的tcp代理程序.
http://dposey.no-ip.com/Proxy/