Documentation ¶
Index ¶
- Variables
- func GetSafetyPeriod() int64
- func GetUserUpdateTime(puname string, coin string) int64
- func HTTPPost(api AutoRegAPIConfig, data interface{}) (response []byte, err error)
- func InitUserCoin(coin string, url string)
- func Main(configFilePath string)
- func RunUserAutoReg(config *ConfigData)
- type APIError
- type AutoRegAPIConfig
- type ConfigData
- type HTTPRequestHandle
- type UserIDMapEmptyResponse
- type UserIDMapResponse
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") // APIErrRecordExists 记录已存在 APIErrRecordExists = NewAPIError(108, "record exists, skip") )
Functions ¶
func GetSafetyPeriod ¶
func GetSafetyPeriod() int64
GetSafetyPeriod 获取用户更新的安全期(在安全期内,子账户可能尚未进入sserver的缓存)
func GetUserUpdateTime ¶
GetUserUpdateTime 获取用户的更新时间(即进入列表的时间)
func HTTPPost ¶
func HTTPPost(api AutoRegAPIConfig, data interface{}) (response []byte, err error)
HTTPPost 调用HTTP Post方法
Types ¶
type AutoRegAPIConfig ¶
type AutoRegAPIConfig struct { IntervalSeconds time.Duration URL string User string Password string DefaultCoin string PostData map[string]string }
AutoRegAPIConfig 用户自动注册API定义
type ConfigData ¶
type ConfigData struct { // UserListAPI 币种对应的用户列表,形如{"btc":"url", "bcc":"url"} UserListAPI map[string]string // IntervalSeconds 每次拉取的间隔时间 IntervalSeconds uint // Zookeeper集群的IP:端口列表 ZKBroker []string // ZKSwitcherWatchDir Switcher监控的Zookeeper路径,以斜杠结尾 ZKSwitcherWatchDir string // EnableUserAutoReg 启用用户自动注册 EnableUserAutoReg bool // ZKAutoRegWatchDir 用户自动注册的zookeeper监控地址,以斜杠结尾 ZKAutoRegWatchDir string // UserAutoRegAPI 用户自动注册API UserAutoRegAPI AutoRegAPIConfig // StratumServerCaseInsensitive 挖矿服务器对子账户名大小写不敏感,此时将总是写入小写的子账户名 StratumServerCaseInsensitive bool // ZKUserCaseInsensitiveIndex 大小写不敏感的子账户索引 //(可空,仅在 StratumServerCaseInsensitive == false 时用到) ZKUserCaseInsensitiveIndex string // 是否启用 API Server EnableAPIServer bool // API Server 的监听IP:端口 ListenAddr string }
ConfigData 配置数据
type HTTPRequestHandle ¶
type HTTPRequestHandle func(http.ResponseWriter, *http.Request)
HTTPRequestHandle HTTP请求处理函数
type UserIDMapEmptyResponse ¶
type UserIDMapEmptyResponse struct { ErrNo int `json:"err_no"` ErrMsg string `json:"err_msg"` Data []interface{} `json:"data"` }
UserIDMapEmptyResponse 用户id列表接口在用户数为0时候的响应
Click to show internal directories.
Click to hide internal directories.