httpsvr

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2018 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartHTTP

func StartHTTP(node *node.BraftNode, user, pwd, endpoint string, allowedOrigins []string)

StartHTTP 在一个新的goroutine里面启动一个HTTPserver

Types

type BlockInfo

type BlockInfo struct {
	Height   int64
	PackTime string `json:"pack_time"`
	Type     string
	Term     int64
	Id       string
	PrevId   string `json:"prev_id"`
}

BlockInfo 转json的结构体

type HTTPHandler

type HTTPHandler struct {
	// contains filtered or unexported fields
}

HTTPHandler 提供了HTTP请求的处理函数

func NewHTTPHandler

func NewHTTPHandler(node *node.BraftNode) *HTTPHandler

NewHTTPHandler 新建一个HTTPHandler对象并返回

func (*HTTPHandler) GetBlockByHeight

func (hd *HTTPHandler) GetBlockByHeight(w http.ResponseWriter, req *http.Request, params httprouter.Params)

func (*HTTPHandler) GetBlockByID

func (hd *HTTPHandler) GetBlockByID(w http.ResponseWriter, req *http.Request, params httprouter.Params)

func (*HTTPHandler) GetBlockHeight

func (hd *HTTPHandler) GetBlockHeight(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

GetBlockHeight 获取当前区块链的高度

func (*HTTPHandler) GetBlocksByHeightSec

func (hd *HTTPHandler) GetBlocksByHeightSec(w http.ResponseWriter, req *http.Request, _ httprouter.Params)

func (*HTTPHandler) GetCurrentBlock

func (hd *HTTPHandler) GetCurrentBlock(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

获取当前区块

func (*HTTPHandler) GetNodes

func (hd *HTTPHandler) GetNodes(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

获取各个节点

func (*HTTPHandler) GetTransActionByID

func (hd *HTTPHandler) GetTransActionByID(w http.ResponseWriter, req *http.Request, params httprouter.Params)

func (*HTTPHandler) GetTxBySidechainTxId

func (hd *HTTPHandler) GetTxBySidechainTxId(w http.ResponseWriter, r *http.Request, params httprouter.Params)

GetTxBySidechainTxId 根据公链的交易ID来查询网关对应的交易状态

type TestInput

type TestInput struct {
	Value string
}

type TxInfo

type TxInfo struct {
	Height           int64
	PackTime         string `json:"pack_time,omitempty"`
	From             string
	To               string
	Amount           int64
	ChainTxId        string           `json:"chain_txid"`
	AddressAmountMap map[string]int64 `json:"address_amount"`
}

Jump to

Keyboard shortcuts

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