service

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2018 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const VerifyCodeDuration = time.Minute
View Source
const VerifyCodeExpired = time.Minute * 15

Variables

This section is empty.

Functions

func AddGenesis

func AddGenesis(remote string) (*model.Genesi, error)

func ChainStatus

func ChainStatus(chainID string, cached bool) (*types.ResultStatus, error)

func CheckCode

func CheckCode(email, code string) bool

CheckCode 验证码校验

func CheckEnv added in v0.0.3

func CheckEnv() error

func CheckSession

func CheckSession(token string) (*account.Account, error)

func CreateBlock

func CreateBlock(b *tmctypes.ResultBlock, vs *tmctypes.ResultValidators) error

CreateBlock 创建一个块

func CreateConsensusState

func CreateConsensusState(chainID string, cs *tmctypes.ResultConsensusState) error

func CreateNode

func CreateNode(name, baseURL, secretKey string, routes []NodeRoute) error

func DeleteNodeByName

func DeleteNodeByName(name string) error

func Doctor added in v0.0.3

func Doctor() error

func ListPeers

func ListPeers(chainID string) (*types.ResultPeers, error)

ListPeers 查询所有peer

func Login

func Login(mail, password string) (*session, error)

func Logout

func Logout(uid int64) error

func RetrieveOrInsert

func RetrieveOrInsert(chainID string, tmp tmtypes.Peer) (*model.Peer, error)

func SavePeers

func SavePeers(chainID string, peers []tmtypes.Peer) error

func SendCode

func SendCode(mailSmtpServer, mailUser, mailPassword, email string) error

SendCode 发送短信验证码

func SyncLock

func SyncLock(key string) bool

SyncLock 同步时锁定,同一个时间只会有一个同步协程

func SyncUnlock

func SyncUnlock(key string) bool

Types

type Env added in v0.0.3

type Env struct {
	EmailSmtpServer string
	EmailUser       string
	EmailPassword   string
}

func GetEnv added in v0.0.3

func GetEnv() Env

type Genesis

type Genesis struct {
	ID          int64     `json:"id"`           // id
	ChainID     string    `json:"chain_id"`     // chain_id
	GenesisTime time.Time `json:"genesis_time"` // genesis_time
	Data        string    `json:"data"`         // data
	CreatedAt   time.Time `json:"created_at"`   // created_at
}

func RetrieveGenesis

func RetrieveGenesis(chainID string) (*Genesis, error)

type Node

type Node struct {
	Name      string       `json:"name"`    // name
	BaseURL   string       `json:"baseUrl"` // base_url
	SecretKey string       `json:"-"`       // secret_key
	Routers   []*NodeRoute `json:"routers"`
	ChanID    string       `json:"chanId"`
	// contains filtered or unexported fields
}

func AllNodes

func AllNodes() ([]*Node, error)

func GetNodeByName

func GetNodeByName(name string) (*Node, error)

func (Node) AppState

func (n Node) AppState(cdc *amino.Codec) (*qbasetypes.GenesisState, error)

type NodeRoute

type NodeRoute struct {
	Route  string `json:"route"`  // route
	Hidden bool   `json:"hidden"` // hidden
	// contains filtered or unexported fields
}

func DefaultRoute

func DefaultRoute(nodeID int64) []NodeRoute

Directories

Path Synopsis
Package pkg comments for pkg account account 管理后台相关功能
Package pkg comments for pkg account account 管理后台相关功能
Package pkg comments for pkg auth auth 请求鉴权
Package pkg comments for pkg auth auth 请求鉴权
Package pkg comments for pkg block block 块相关数据封装
Package pkg comments for pkg block block 块相关数据封装

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL