Documentation
¶
Index ¶
- Variables
- func Main(configFilePath string)
- func RunCronJob()
- type APIError
- type APIResponse
- type ConfigData
- type HTTPRequestHandle
- type SubPoolCoinbase
- type SubPoolUpdate
- type SubPoolUpdateAck
- type SubPoolUpdateAckInner
- type SwitchMultiUserRequest
- type SwitchUserCoins
- type UserCoinMapData
- type UserCoinMapResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // APIErrPunameIsEmpty puname为空 APIErrPunameIsEmpty = NewAPIError(101, "puname is empty") // APIErrPunameInvalid puname不合法 APIErrPunameInvalid = NewAPIError(102, "puname invalid") // APIErrCoinIsEmpty coin为空 APIErrCoinIsEmpty = NewAPIError(103, "coin is empty") // APIErrCoinIsInexistent coin为空 APIErrCoinIsInexistent = NewAPIError(104, "coin is inexistent") // APIErrReadRecordFailed 读取记录失败 APIErrReadRecordFailed = NewAPIError(105, "read record failed") // APIErrWriteRecordFailed 写入记录失败 APIErrWriteRecordFailed = NewAPIError(107, "write record failed") // APIErrUserCoinsEmpty 用户币种数组为空 APIErrUserCoinsEmpty = NewAPIError(108, "usercoins is empty") )
Functions ¶
Types ¶
type APIResponse ¶
type APIResponse struct {
ErrNo int `json:"err_no"`
ErrMsg string `json:"err_msg"`
Success bool `json:"success"`
}
APIResponse API响应数据结构
type ConfigData ¶
type ConfigData struct {
// 是否启用 API Server
EnableAPIServer bool
// API 用户名
APIUser string
// API 密码
APIPassword string
// API Server 的监听IP:端口
ListenAddr string
// AvailableCoins 可用币种,形如 {"btc", "bcc", ...}
AvailableCoins []string
// Zookeeper集群的IP:端口列表
ZKBroker []string
// ZKSwitcherWatchDir Switcher监控的Zookeeper路径,以斜杠结尾
ZKSwitcherWatchDir string
// 是否启用定时检测任务
EnableCronJob bool
// 定时检测间隔时间
CronIntervalSeconds int
// 用户:币种对应表的URL
UserCoinMapURL string
// 挖矿服务器对子账户名大小写不敏感,此时将总是写入小写的子账户名
StratumServerCaseInsensitive bool
//子池更新用的zookeeper根目录(注意,不应包括币种和子池名称),以斜杠结尾
ZKSubPoolUpdateBaseDir string
// 子池更新时jobmaker的应答超时时间,如果在该时间内jobmaker没有应答,则API返回错误
ZKSubPoolUpdateAckTimeout int
}
ConfigData 配置数据
type HTTPRequestHandle ¶
type HTTPRequestHandle func(http.ResponseWriter, *http.Request)
HTTPRequestHandle HTTP请求处理函数
type SubPoolCoinbase ¶
type SubPoolCoinbase struct {
Success bool `json:"success"`
ErrNo int `json:"err_no"`
ErrMsg string `json:"err_msg"`
SubPoolName string `json:"subpool_name"`
Old struct {
CoinbaseInfo string `json:"coinbase_info"`
PayoutAddr string `json:"payout_addr"`
} `json:"old"`
}
SubPoolCoinbase 子池Coinbase信息
type SubPoolUpdate ¶
type SubPoolUpdate struct {
Coin string `json:"coin"`
SubPoolName string `json:"subpool_name"`
CoinbaseInfo string `json:"coinbase_info"`
PayoutAddr string `json:"payout_addr"`
}
SubPoolUpdate 子池更新信息
type SubPoolUpdateAck ¶
type SubPoolUpdateAck struct {
SubPoolCoinbase
New struct {
CoinbaseInfo string `json:"coinbase_info"`
PayoutAddr string `json:"payout_addr"`
} `json:"new"`
}
SubPoolUpdateAck 子池更新响应
type SubPoolUpdateAckInner ¶
type SubPoolUpdateAckInner struct {
SubPoolUpdateAck
Host struct {
HostName string `json:"hostname"`
} `json:"host"`
}
SubPoolUpdateAckInner 子池更新响应(非公开)
type SwitchMultiUserRequest ¶
type SwitchMultiUserRequest struct {
UserCoins []SwitchUserCoins `json:"usercoins"`
}
SwitchMultiUserRequest 多用户切换请求数据结构
type SwitchUserCoins ¶
SwitchUserCoins 欲切换的用户和币种
type UserCoinMapData ¶
type UserCoinMapData struct {
UserCoin map[string]string `json:"user_coin"`
NowDate int64 `json:"now_date"`
}
UserCoinMapData 用户币种列表接口响应的data字段数据结构
type UserCoinMapResponse ¶
type UserCoinMapResponse struct {
ErrNo int `json:"err_no"`
ErrMsg string `json:"err_msg"`
Data UserCoinMapData `json:"data"`
}
UserCoinMapResponse 用户币种列表接口响应的数据结构
Click to show internal directories.
Click to hide internal directories.