Make tcp proxy easy to use.
Introduction
+----------+ +------------+
| client |<--------+ | |
+----------+ +-------->+-----+<--------------->| server |
| | | |
+----------+ | | +------------+
| client |<----------------->| |
+----------+ | |
| | +------------+
+----------+ | L | | |
| client |<----------------->| B |<--------------->| server |
+----------+ | S | | |
| | +------------+
+----------+ | |
| client |<----------------->| |
+----------+ | | +------------+
| | | |
+----------+ +--------->+-----+<--------------->| server |
| client |<-------+ | |
+----------+ +------------+
As the chart above, easyproxy act as the LBS server. If you meet the situation that cannot access some service directly or need a server as a gateway, you may use this to proxy.
Usage
go get github.com/xsank/EasyProxy
go run build.go build- The sample config is about mysql proxy, so you can access the mysql database actually at backend through the
localhost 9527, you can easily modify thedefault.jsonto change the service. Any protocol based onTCPwould work well such as:mysql, ssh, svn... - For keep simple, easyproxy only support
poll,random,iphashstrategies, and the default strategy ispoll,the easyproxy would add more if there is a demand. - Besides, you can
curl localhost:7259/statisticto get the current connection status. If you want to know more runtime debug info about the proxy, you cancurl http://localhost:7259/debug/pprofto get more details. - You can change the number of MAX processorsand and the heartbeat time based on your requirements.
from https://github.com/xsank/EasyProxy
No comments:
Post a Comment