2 Star 4 Fork 0

Zoker / ProxyBalance

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Proxy Balance Http(s) 动态代理工具

PBS Server is a http/https proxy balancer, used for select best proxies automaticly.

本工具是为了简单快速的实现一个动态 Http(s) 代理而写,项目上最近有用到 HaProxy 进行相关实现,但是还是感觉太重,而且不支持根据代理的质量(比如时延)进行择优,毕竟代理的网络稳定性并不能得到保障,本着简单的事情只需要简单的实现原则,动手写了一个小工具,分享出来给用得到的人。

功能介绍

  • 提供 PBS 客户端用来调度请求的代理链接
  • 提供 PBC 客户端用来快速配置代理节点
  • 支持配置多节点及权重(WRR)
  • 支持代理节点分组
  • 支持动态检测节点并调整权重或移除废弃节点(ing)
  • 支持配置单节点最大并发连接数(ing)
  • 支持配置最大并发连接后的阻断或阻塞模式(ing)

设计草稿

输入图片说明

目录结构

├── LICENSE
├── Readme.md
├── go.mod
├── go.sum
├── pbc
│   ├── config.go
│   └── pbc.go // pbc client, used for config a proxy
├── pbs
│   ├── checker.go
│   ├── config.go
│   ├── pbs.go // pbs server, used for manage proxies
│   ├── pbs.json
│   ├── pbs.json.example
│   └── proxy.go
└── test
    └── testServer.go // tools for test servers

使用说明

PBS Server

下载编译构建好的 PBS 客户端,执行./pbs -h

Usage: Config your pbs.json and start pbs with command ./pbs -c ./config.json &

Args:
	-c	Specify a config json
	-h	Help and quit
	-v	Show current version and quit

配置pbs.json

{
  "Port": 7788,   // port for pbs listening
  "ActiveProxyGroups": "all", // select which groups actived, eg: 'all' or 'asia,africa' are same
  "Proxies": {
    "asia": [
      "127.0.0.1:7791 5", // ip:port weight
      "127.0.0.1:7792 1"
    ],
    "africa": [
      "127.0.0.1:7793 1"
    ]
  }
}

使用 ./pbs -c ./pbs.json 启动即可

PBC Client

PBC 配置在你的代理节点,执行./pbc -h

Usage: you can start pbc at port 7799 with command ./pbc -p 7799 &

Args:
	-p	Specify PBC client port to start
	-h	Help and quit
	-v	Show current version and quit

使用./pbc -p 7791 即可将服务启动在 7791 端口

构建说明

项目很简单,你只需要下载代码,然后分别执行

go build pbs.go
go build pbc.go
go build test/testServer.go

即可得到对应的二进制可执行文件

贡献代码

  1. Fork 仓库
  2. 创建本地分支 (git checkout -b my-new-feature)
  3. 提交更改 (git commit -am 'Add some feature')
  4. 推送到分支 (git push origin my-new-feature)
  5. 创建一个 Pull Request

贡献者

@Zoker

MIT License Copyright (c) 2020 Zoker Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Proxy Balance is a http/https proxy balancer, used for select best proxies automaticly. 展开 收起
Go
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/kesin/ProxyBalance.git
git@gitee.com:kesin/ProxyBalance.git
kesin
ProxyBalance
ProxyBalance
master

搜索帮助