Documentation
¶
Index ¶
- Constants
- Variables
- func AddChan(chanKey string, grpcStream *GrpcStreamChan)
- func AddChanWithChan(chanKey string, modelChan chan *GrpcStreamModel, quitChan chan bool)
- func CheckAddress(address string, category int64) bool
- func ClearAllPassStatus(key string)
- func ClearPassStatus(key string)
- func DelayGetPassStatus(key string) string
- func GetPassStatus(key string) string
- func InitChanMap()
- func RomoveChan(chanKey string)
- func SendChanMsg(chanKey string, msgByte []byte) bool
- func SetPassStatus(key string, value string)
- func VerifySign(msg, pubkey, signature string) (bool, error)
- type ApprovalInfo
- type Assets
- type CoinStatu
- type GrpcStream
- type GrpcStreamChan
- type GrpcStreamModel
- type HashOperate
- type KeyStoreStatu
- type NodeAuthorized
- type Operate
- type RegistInfo
- type RegistInfoList
- type SignInfo
- type TokenInfo
- type TxHistory
- type TxInfo
- type TxInfoList
- type VReq
- type VRsp
- type VoucherStatus
Constants ¶
View Source
const ( FALSE = "0" TRUE = "1" INVALID = "2" GREATE = "3" OTHER = "4" )
View Source
const ( REQ_TYPE_ALL = "all" //全部 REQ_TYPE_RANDOM = "random" //随机 )
View Source
const ( ROUTER_TYPE_WEB = "web" ROUTER_TYPE_GRPC = "grpc" )
View Source
const ( Err_OK = "0" //正确 Err_UNKNOW_REQ_TYPE = "10" //未知请求类型 Err_JSON = "11" //JSON处理失败 Err_LDB = "12" //leveldb处理失败 Err_RDB = "13" //关系型数据库处理失败 Err_SERVER_NOTFOUND = "100" //服务未发现 Err_UNENABLE_PREFIX = "101" //非法hash前缀 Err_UNENABLE_LENGTH = "102" //非法hash值长度 Err_UNENABLE_AMOUNT = "103" //非法金额 Err_DATE = "104" //非法金额 Err_UNENABLE_CATEGORY = "105" //非法转账类型 Err_UNENABLE_ADDRESS = "106" //非法地址格式 Err_WRONG_PASS = "107" //错误密码 Err_VOUCHER_REQERR = "108" //请求voucher错误 Err_APPSERVER = "109" // 请求appServer失败 Err_USER = "110" // 非法用户 Err_SIGN = "111" // 签名信息错误 Err_REPEAT_REQ = "112" //重复请求 )
View Source
const ( VOUCHER_STATUS_UNCONNETED = 0 //未连接 VOUCHER_STATUS_UNCREATED = 1 //未创建 VOUCHER_STATUS_CREATED = 2 //已创建 VOUCHER_STATUS_DEPLOYED = 3 //已发布 VOUCHER_STATUS_STATED = 4 //已启动 )
签名机状态
View Source
const ( REQ_DEPOSIT = "1" //充值上报 REQ_WITHDRAW = "2" //提现上报 REQ_WITHDRAW_TX = "3" //提现tx上报 REQ_TOKEN_CHANGE = "4" //token新增 REQ_REGIST = "5" //token新增 )
上报类型
View Source
const ( HASH_TYPE_ALLOW = "allow" //同意 HASH_TYPE_DISALLOW = "disallow" //拒绝 )
上报类型
View Source
const ( GRPC_HASH_ADD_REQ = "1" //hash add申请 GRPC_HASH_ADD_LOG = "2" //hans add 私链log GRPC_HASH_ENABLE_REQ = "3" //hash enable 申请 GRPC_HASH_ENABLE_LOG = "4" //hash enable 私链log GRPC_HASH_DISABLE_REQ = "5" //hash disable 申请 GRPC_HASH_DISABLE_LOG = "6" //hash disable 私链log GRPC_WITHDRAW_REQ = "7" //提现 申请 GRPC_WITHDRAW_LOG = "8" //提现 私链log GRPC_DEPOSIT_WEB = "9" //充值上报 GRPC_WITHDRAW_TX_WEB = "10" //提现tx上报 GRPC_WITHDRAW_WEB = "11" //提现结果上报 GRPC_VOUCHER_OPR_REQ = "12" //签名机操作处理 //GRPC_HASH_LIST_REQ = "13" //审批流查询 //GRPC_HASH_LIST_WEB = "14" //审批流上报 GRPC_TOKEN_LIST_WEB = "15" //token上报 GRPC_COIN_LIST_WEB = "16" //coin上报 GRPC_HASH_ENABLE_WEB = "17" //hash enable 公链log GRPC_HASH_DISABLE_WEB = "18" //hash enable 公链log GRPC_CHECK_KEY_WEB = "19" //密码验证 )
grpc接口
View Source
const ( VOUCHER_OPERATE_ADDKEY = "0" //添加公钥 VOUCHER_OPERATE_CREATE = "1" //创建 VOUCHER_OPERATE_DEPLOY = "2" //发布 VOUCHER_OPERATE_START = "3" //启动 VOUCHER_OPERATE_PAUSE = "4" //停止 VOUCHER_OPERATE_HASH_ENABLE = "5" //hash同意 VOUCHER_OPERATE_HASH_DISABLE = "6" //hash拒绝 VOUCHER_OPERATE_HASH_LIST = "7" //hash list 查询 VOUCHER_OPERATE_TOKEN_ADD = "8" //token 添加 VOUCHER_OPERATE_TOKEN_DEL = "9" //token 删除 VOUCHER_OPERATE_TOKEN_LIST = "10" //token list 查询 VOUCHER_OPERATE_COIN = "11" //coin 操作 VOUCHER_OPERATE_CHECK_KEY = "12" //密码验证 )
View Source
const ( HASHLIST_PRIFIX = "hlp_" TOKENLIST_PRIFIX = "tlp_" REGIST_INFO_PRIFIX = "rip_" APPROVAL_INFO_PRIFIX = "aip_" )
View Source
const ( HASH_STATUS_0 = "0" //待申请 HASH_STATUS_1 = "1" //私钥已申请提交 HASH_STATUS_2 = "2" //私钥已拒绝提交 私钥A拒绝 HASH_STATUS_3 = "3" //私链已申请确认(日志) HASH_STATUS_4 = "4" //私链已同意确认 私钥B、私钥C均同意 HASH_STATUS_5 = "5" //私链已拒绝确认 私钥B、私钥C有不同意 HASH_STATUS_6 = "6" //私链已同意(日志) HASH_STATUS_7 = "7" //公链已同意 HASH_STATUS_8 = "8" //公链已拒绝 HASH_STATUS_9 = "9" //创建者作废 WITHDRAW_STATUS_0 = "0" //申请中 WITHDRAW_STATUS_1 = "1" //私链已确认 )
View Source
const ( CURRENCY_TYPE_BTC = "0" CURRENCY_TYPE_ETH = "1" )
View Source
const ( CATEGORY_BTC int64 = 0 CATEGORY_ETH int64 = 1 )
View Source
const ( APPROVAL_TYPE_0 = "0" //待私钥审批 APPROVAL_TYPE_1 = "1" //审批中及审批结束 APPROVAL_TYPE_2 = "2" //审批完成-同意状态 APPROVAL_TYPE_3 = "3" //审批完成-同意|拒绝状态|作废 )
View Source
const ( REG_REJEST = "1" // 审批注册拒绝 REG_APPROVAL = "2" // 审批注册同意 )
View Source
const ( //密码验证状态 PASSS_STATUS_OTHER = "OTHER" //未连接 PASSS_STATUS_TRUE = "TRUE" //正确 PASSS_STATUS_FALSE = "FALSE" //错误 )
View Source
const (
CHAN_MAX_SIZE = 100000
)
View Source
const HASH_PRIFIX = "0x"
Variables ¶
View Source
var GrpcStreamChanMap map[string]*GrpcStreamChan
View Source
var Ldb *db.Ldb
View Source
var MANAGER_SERVER_IPPORT string
View Source
var SERVER_COMPANION = "companion"
View Source
var SERVER_VOUCHER = "voucher"
View Source
var VReqChan chan *VReq = make(chan *VReq, CHAN_MAX_SIZE)
请求channel
Functions ¶
func AddChan ¶
func AddChan(chanKey string, grpcStream *GrpcStreamChan)
func AddChanWithChan ¶
func AddChanWithChan(chanKey string, modelChan chan *GrpcStreamModel, quitChan chan bool)
func ClearAllPassStatus ¶
func ClearAllPassStatus(key string)
func ClearPassStatus ¶
func ClearPassStatus(key string)
func GetPassStatus ¶
func InitChanMap ¶
func InitChanMap()
func RomoveChan ¶
func RomoveChan(chanKey string)
func SendChanMsg ¶
func SetPassStatus ¶
Types ¶
type ApprovalInfo ¶
type ApprovalInfo struct {
Hash string //id
Name string //名称
AppId string //申请 appid
CaptainId string // 私钥id
Flow string //原始内容
Sign string //签名内容
Status string //状态
}
hash信息
type GrpcStream ¶
type GrpcStream struct {
Type string
BlockNumber uint64 //区块号
AppId string //申请人
Hash common.Hash
WdHash common.Hash
TxHash string
Amount *big.Int
Fee *big.Int
Account string
From string
To string
Category *big.Int
Flow string //原始内容
Sign string //签名信息
WdFlow string //提现原始数据
Status string
VoucherOperate *Operate
ApplyTime time.Time //申请时间
TokenList []*TokenInfo
SignInfos []*SignInfo
}
grpc stream
type GrpcStreamChan ¶
type GrpcStreamChan struct {
ModelChan chan *GrpcStreamModel
QuitChan chan bool
}
type GrpcStreamModel ¶
type GrpcStreamModel struct {
Msg []byte
}
type HashOperate ¶
type HashOperate struct {
ApplyerAccount string
CaptainId string
Option string //同意拒绝
Opinion string //操作意见
CreateTime string
}
hash 审批操作
type KeyStoreStatu ¶
type NodeAuthorized ¶
type Operate ¶
type Operate struct {
Type string
AppId string //appid
AppName string //app别名
Hash string
Password string
ReqIpPort string
Code string
PublicKey string
TokenName string
Decimals int64
ContractAddr string
CoinCategory int64 //币种分类
CoinUsed bool //币种使用
Sign string //签名
PassSign string //密码签名
}
私钥-签名机操作
type RegistInfo ¶
type RegistInfo struct {
RegId string
ApplyerId string
CaptainId string
ApplyerAccount string
Msg string
Status string
}
注册信息
type TxHistory ¶
type TxHistory struct {
RspNo int `json:"code"`
Message string `json:"message"`
Data TxInfoList `json:"data"`
}
type TxInfo ¶
type TxInfo struct {
OrderNum string `json:"order_number"`
Tag string `json:"tx_info"`
Progress int64 `json:"progress"`
Arrived int64 `json:"arrived"`
Amount string `json:"amount"`
Currency string `json:"currency"`
ApplyAt int64 `json:"apply_at"`
TxType int `json:"type"`
CurrencyID int `json:"currency_id"`
}
type TxInfoList ¶
type VReq ¶
type VReq struct {
ReqType string
Account string
From string
To string
Category int64
Amount string
WdHash string
TxHash string
CurrencyType string
RegId string
Consent string
CipherText string
PubKey string
Status string
AppID string
}
请求数据
type VoucherStatus ¶
type VoucherStatus struct {
ServerStatus int64 //系统状态
Status int64 //错误码状态
Total int64 //密钥数量
HashCount int64 //hash数量
TokenCount int64 //token数量
Address string //账户地址
ContractAddress string //合约地址
BtcAddress string //比特币地址
D string //随机数
NodesAuthorized []NodeAuthorized //授权情况
KeyStoreStatus []KeyStoreStatu //公钥添加状态
CoinStatus []CoinStatu //币种状态
}
var RealTimeVoucherStatus *VoucherStatus = &VoucherStatus{ServerStatus: VOUCHER_STATUS_UNCONNETED}
Click to show internal directories.
Click to hide internal directories.