简单 TCP 路由代理:tproxy
jopen
9年前
tproxy 是简单 TCP 路由代理 (layer 7) ,基于 Gevent,可以使用 Python 配置路线逻辑。tproxy 灵感来源于 proxy machine,但是有一些独特的特性,比如 Gunicorn 的预先 fork 人工模式。
使用:
$ tproxy -h Usage: tproxy [OPTIONS] script_path Options: --version show program's version number and exit -h, --help show this help message and exit --log-file=FILE The log file to write to. [-] --log-level=LEVEL The granularity of log outputs. [info] --log-config=FILE The log config file to use. [None] -n STRING, --name=STRING A base to use with setproctitle for process naming. [None] -D, --daemon Daemonize the tproxy process. [False] -p FILE, --pid=FILE A filename to use for the PID file. [None] -u USER, --user=USER Switch worker processes to run as this user. [501] -g GROUP, --group=GROUP Switch worker process to run as this group. [20] -m INT, --umask=INT A bit mask for the file mode on files written by tproxy. [0] -b ADDRESS, --bind=ADDRESS The socket to bind. [127.0.0.1:8000] --backlog=INT The maximum number of pending connections. [2048] --ssl-keyfile=STRING Ssl key file [None] --ssl-certfile=STRING Ssl ca certs file. contains concatenated "certification [None] --ssl-ca-certs=STRING Ssl ca certs file. contains concatenated "certification [None] --ssl-cert-reqs=INT Specifies whether a certificate is required from the other [0] -w INT, --workers=INT The number of worker process for handling requests. [1] --worker-connections=INT The maximum number of simultaneous clients per worker. [1000] -t INT, --timeout=INT Workers silent for more than this many seconds are killed and restarted. [30]