VKProxy的命令行、镜像和UI,能为吗?
摘要:VKProxy 是使用c#开发的基于 Kestrel 实现 L4L7的代理 经过6个月业余时间偶尔缝缝补补,已经达到能跑的地步了 (感兴趣的同学烦请点个github小赞赞呢) 相关使用写了一些简单的文档说明 安装 通过UI站点配置 不同监
VKProxy 是使用c#开发的基于 Kestrel 实现 L4/L7的代理
经过6个月业余时间偶尔缝缝补补,已经达到能跑的地步了 (感兴趣的同学烦请点个github小赞赞呢)
相关使用写了一些简单的文档说明
安装
通过UI站点配置
不同监听场景如何配置
如何为HTTP配置路由复杂匹配
如何为HTTP配置请求和响应转换
这里列举一下新增的安装使用方式
dotnet tool
提供简单的命令行工具,可以在本地进行相关测试
dotnet tool install --global VKProxy.Cli
不过目前只支持 net9.0 (net10 正式发布后会切换制net10)
安装后可以使用如下命令
vkproxy -h
// it will output
--config (-c) json file config, like /xx/app.json
--socks5 use simple socks5 support
--etcd etcd address, like http://127.0.0.1:2379
--etcd-prefix default is /ReverseProxy/
--etcd-delay delay change config when etcd change, default is 00:00:01
--help (-h) show all options
View more at https://fs7744.github.io/VKProxy.Doc/docs/introduction.html
如果使用json文件配置
配置项很多,可参考后续具体配置项说明
这里举个例子
创建json文件
{
"ReverseProxy": {
"Listen": {
"http": {
"Protocols": [
"Http1"
],
"Address": [
"127.0.0.1:5001"
]
}
},
"Routes": {
"HTTPTEST": {
"Match": {
"Hosts": [
"*com"
],
"Paths": [
"/ws*"
],
"Statement": "Method = 'GET'"
},
"ClusterId": "apidemo",
"Timeout": "00:10:11"
}
},
"Clusters": {
"apidemo": {
"LoadBalancingPolicy": "RoundRobin",
"HealthCheck": {
"Active": {
"Enable": true,
"Policy": "Http",
"Path": "/test",
"Query": "?a=d",
"Method": "post"
}
},
"Destinations": [
{
"Address": "http://127.0.0.1:1104"
},
{
"Address": "https://google.com"
}
]
}
}
}
}
然后启动
vkproxy -c D:\code\test\proxy\config.json
// 启动后会看到类似如下的内容
info: VKProxy.Server.ReverseProxy[3]
Listening on: [Key: http,Protocols: HTTP1,EndPoint: 127.0.0.1:5001]
info: Microsoft.Hosting.Lifetime[0]
Application started. Press
