proxy/README.md

62 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 代理项目
Go语言编写的矿工代理服务支持矿工连接代理并动态切换矿池地址。
## 功能
- 矿工连接代理服务
- 默认代理到指定矿池地址
- 通过RabbitMQ消息动态切换矿池
- 支持多种加密货币
## 快速开始
### 环境要求
- Go 1.23.1+
### 编译运行
```bash
# 编译代理程序
go build -o proxy.exe cmd/proxy.go
# 运行代理程序
./proxy.exe
```
### 配置文件
创建 `config.json`
```json
{
"coin": "your_coin",
"zmqAddr": "amqp://localhost:5672",
"tcpAddr": ":3333",
"proxyAddr": "pool.example.com:3333",
"rabbitTopic": "proxy_queue"
}
```
## 项目结构
```
├── cmd/proxy.go # 代理程序入口
├── internal/
│ ├── miner/miner.go # 矿工连接管理
│ ├── msg/msg.go # 消息结构
│ ├── proxy.go # 代理服务核心
│ └── zmq/zmq.go # RabbitMQ处理
└── go.mod # 依赖管理
```
## 使用说明
- **proxy.exe**: 矿工代理服务 (监听TCP连接)
## 工作流程
1. 矿工连接代理服务
2. 代理使用默认矿池地址
3. 收到RabbitMQ消息可切换矿池
4. 持续转发矿工和矿池消息