webserver

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ValidTransaction       = "ValidTransaction"
	GetBlockByHeight       = "GetBlockByHeight"
	GetBlockByHash         = "GetBlockByHash"
	GetBlockByTxKey        = "GetBlockByTxKey"
	GetLastBlock           = "GetLastBlock"
	GetTransactionByTxKey  = "GetTransactionByTxKey"
	GetTransactionTotalNum = "GetTransactionTotalNum"
	GetBlockTotalNum       = "GetBlockTotalNum"
	GetCurrentBlockHeight  = "GetCurrentBlockHeight"
)
View Source
const (
	Ok                    string = "OK"                    // 正常结果码
	InvalidParameter      string = "InvalidParameter"      // 参数错误(包括参数格式、类型等错误)
	InvalidParameterValue string = "InvalidParameterValue" // 参数取值错误
	MissingParameter      string = "MissingParameter"      // 缺少参数错误,必传参数没填
	UnknownParameter      string = "UnknownParameter"      // 未知参数错误,用户多传未定义的参数会导致错误
	SignatureExpire       string = "SignatureExpire"       // 签名过期
	UnauthorizedOperation string = "UnauthorizedOperation" // 请求未CAM授权
	SecretIdNotFound      string = "SecretIdNotFound"      // 密钥不存在
	SignatureFailure      string = "SignatureFailure"      // 签名错误
	TokenFailure          string = "TokenFailure"          // token错误
	MFAFailure            string = "MFAFailure"            // MFA错误
	InvalidSecretId       string = "InvalidSecretId"       // 密钥非法(不是云API密钥类型)
	InternalError         string = "InternalError"         // 内部错误
	InvalidAction         string = "InvalidAction"         // 接口不存在
	RequestLimitExceeded  string = "RequestLimitExceeded"  // 请求的次数超过了频率限制
	NoSuchVersion         string = "NoSuchVersion"         // 接口版本不存在
	UnsupportedRegion     string = "UnsupportedRegion"     // 接口不支持所传地域
	UnsupportedOperation  string = "UnsupportedOperation"  // 操作不支持
	ResourceNotFound      string = "ResourceNotFound"      // 资源不存在
	LimitExceeded         string = "LimitExceeded"         // 超过配额限制
	ResourceUnavailable   string = "ResourceUnavailable"   // 资源不可用
	ResourceInsufficient  string = "ResourceInsufficient"  // 资源不足
	FailedOperation       string = "FailedOperation"       // 操作失败
	ResourceInUse         string = "ResourceInUse"         // 资源被占用
	DryRunOperation       string = "DryRunOperation"       // DryRun操作,代表请求将会是成功的,只是多传了DryRun参数
	ResourcesSoldOut      string = "ResourcesSoldOut"      // 资源售罄
	OperationDenied       string = "OperationDenied"       // 操作被拒绝
	DBOperateError        string = "DBOperateError"        // 数据库操作错误
	RecordNotFound        string = "RecordNotFound"        // 数据库中数据不存在错误
)

Variables

This section is empty.

Functions

func JsonErrResponse

func JsonErrResponse(ctx *gin.Context, code string, err error)

func JsonOKResponse

func JsonOKResponse(ctx *gin.Context, data interface{})

Types

type Response

type Response struct {
	Code    string      `json:"code,omitempty"` // omit when success
	Message string      `json:"message,omitempty"`
	Data    interface{} `json:"data,omitempty"`
}

type WebServer

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

WebServer is a web listener of web for SPV and light node

func NewWebServer

func NewWebServer(spvSer *server.SPVServer) *WebServer

NewWebServer creates a instance of web server

func (*WebServer) Start

func (ws *WebServer) Start() error

Start starts up web server

func (*WebServer) Stop

func (ws *WebServer) Stop() error

Stop stops web server

type WithChainId

type WithChainId struct {
	ChainId    string `json:"chainId"`
	FromRemote bool   `json:"fromRemote"`
}

func (*WithChainId) IsComplete

func (w *WithChainId) IsComplete() error

type WithChainIdAndHash

type WithChainIdAndHash struct {
	ChainId    string `json:"chainId"`
	Hash       string `json:"hash"`
	FromRemote bool   `json:"fromRemote"`
}

func (*WithChainIdAndHash) IsComplete

func (w *WithChainIdAndHash) IsComplete() error

type WithChainIdAndHeight

type WithChainIdAndHeight struct {
	ChainId    string `json:"chainId"`
	Height     uint64 `json:"height"`
	FromRemote bool   `json:"fromRemote"`
}

func (*WithChainIdAndHeight) IsComplete

func (w *WithChainIdAndHeight) IsComplete() error

type WithChainIdAndTxKey

type WithChainIdAndTxKey struct {
	ChainId    string `json:"chainId"`
	TxKey      string `json:"txKey"`
	FromRemote bool   `json:"fromRemote"`
}

func (*WithChainIdAndTxKey) IsComplete

func (w *WithChainIdAndTxKey) IsComplete() error

Jump to

Keyboard shortcuts

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