gateway

package
v0.0.0-...-d5522c5 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

README

简介

为了支持以http方式调用xchain,实现了mini版的网关: http_gateway.go,该mini版的网关作为中间件的角色存在,用户的http请求直接转发给该网关,之后由该网关将http请求转换成grpc请求与xchain进行交互,并将交互结果转发给客户。

使用

1.查询xuper链上高度为5的区块数据

命令:

curl http://localhost:8098/v1/get_block_by_height -d '{"bcname":"xuper", "height":5}'

结果如下: 查询xuper链上高度为5的区块数据

2.查询bob的余额

命令:

curl http://localhost:8098/v1/get_balance -d '{"bcs":[{"bcname":"xuper"}],"address":"bob"}'

结果如下: 查询bob的余额

3.查询xuper链的状态

命令:

curl http://localhost:8098/v1/get_bcstatus -d '{"bcname":"xuper"}'

结果如下: 查询xuper链的状态

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gateway

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

func NewGateway

func NewGateway(scfg *sconf.ServConf) (*Gateway, error)

func (*Gateway) Exit

func (t *Gateway) Exit()

退出gateway服务,释放相关资源,需要幂等

func (*Gateway) Run

func (t *Gateway) Run() error

启动gateway服务

Jump to

Keyboard shortcuts

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