100行代码只使用Ruby的标准库实现的正向代理程序。

使用样例
$ forward-proxy --binding 0.0.0.0 --port 3182 --threads 2
[2021-01-14 19:37:47 +1100] INFO Listening 0.0.0.0:3182
[2021-01-14 19:38:24 +1100] INFO CONNECT raw.githubusercontent.com:443 HTTP/1.1
通过命令行使用
Usage: forward-proxy [options]
-p, --port=PORT Bind to specified port. Default: 9292
-b, --binding=BINDING Bind to the specified ip. Default: 127.0.0.1
-t, --threads=THREADS Specify the number of client threads. Default: 32
-h, --help Prints this help.
通过库引入
require 'forward_proxy'
proxy = ForwardProxy::Server.new(
bind_address: "127.0.0.1",
bind_port: 3000
)
proxy.start
网友评论