api

package
v0.0.0-...-6b2b62e Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: GPL-3.0 Imports: 33 Imported by: 0

Documentation

Overview

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut

Package api provides API for chestnut.

Package api provides API for chestnut.

Package api provides API for chestnut.

Index

Constants

View Source
const (
	GROUP_NAME         string = "group_name"
	GROUP_ID           string = "group_id"
	GROUP_OWNER_PUBKEY string = "owner_pubkey"
	GROUP_ITEMS        string = "group_items"
	GROUP_ITEM         string = "group_item"
	GENESIS_BLOCK      string = "genesis_block"
	NODE_VERSION       string = "node_version"
	NODE_PUBKEY        string = "node_publickey"
	NODE_STATUS        string = "node_status"
	NODE_ID            string = "node_id"
	SIGNATURE          string = "signature"
	TRX_ID             string = "trx_id"
	PEERS              string = "peers"
	NODETYPE           string = "node_type"
)

const name

View Source
const (
	Add      = "Add"
	Update   = "Update"
	Remove   = "Remove"
	Group    = "Group"
	User     = "User"
	Auth     = "Auth"
	Note     = "Note"
	Producer = "Producer"
	Announce = "Announce"
	App      = "App"
)
View Source
const BLACK_LIST_OP_PREFIX string = "blklistop_"
View Source
const ERROR_INFO string = "error"

error

View Source
const GROUP_NAME_MIN_LENGTH int = 5

config

Variables

This section is empty.

Functions

func StartAPIServer

func StartAPIServer(config cli.Config, signalch chan os.Signal, h *Handler, apph *appapi.Handler, node *p2p.Node, nodeopt *options.NodeOptions, ks localcrypto.Keystore, ethaddr string, isbootstrapnode bool)

Types

type AddPeerResult

type AddPeerResult struct {
	SuccCount int `json:"succ_count"`
	ErrCount  int `json:"err_count"`
}

type AnnounceParam

type AnnounceParam struct {
	GroupId string `from:"group_id"    json:"group_id"    validate:"required"`
	Action  string `from:"action"      json:"action"      validate:"required,oneof=add remove"`
	Type    string `from:"type"        json:"type"        validate:"required,oneof=user producer"`
	Memo    string `from:"memo"        json:"memo"        validate:"required"`
}

type AnnounceResult

type AnnounceResult struct {
	GroupId                string `json:"group_id"`
	AnnouncedSignPubkey    string `json:"sign_pubkey"`
	AnnouncedEncryptPubkey string `json:"encrypt_pubkey"`
	Type                   string `json:"type"`
	Action                 string `json:"action"`
	Sign                   string `json:"sign"`
	TrxId                  string `json:"trx_id"`
}

type AnnouncedProducerListItem

type AnnouncedProducerListItem struct {
	AnnouncedPubkey string
	AnnouncerSign   string
	Result          string
	TimeStamp       int64
}

type AnnouncedUserListItem

type AnnouncedUserListItem struct {
	AnnouncedSignPubkey    string
	AnnouncedEncryptPubkey string
	AnnouncerSign          string
	Result                 string
}

type CreateGroupParam

type CreateGroupParam struct {
	GroupName      string `from:"group_name" json:"group_name" validate:"required,max=20,min=5"`
	ConsensusType  string `from:"consensus_type"  json:"consensus_type"  validate:"required,oneof=pos poa"`
	EncryptionType string `from:"encryption_type" json:"encryption_type" validate:"required,oneof=public private"`
	AppKey         string `from:"app_key"         json:"app_key"         validate:"required,max=20,min=5"`
}

type CreateGroupResult

type CreateGroupResult struct {
	GenesisBlock       *chestnutpb.Block `json:"genesis_block"`
	GroupId            string            `json:"group_id"`
	GroupName          string            `json:"group_name"`
	OwnerPubkey        string            `json:"owner_pubkey"`
	OwnerEncryptPubkey string            `json:"owner_encryptpubkey"`
	ConsensusType      string            `json:"consensus_type"`
	EncryptionType     string            `json:"encryption_type"`
	CipherKey          string            `json:"cipher_key"`
	AppKey             string            `json:"app_key"`
	Signature          string            `json:"signature"`
}

type CustomBinder

type CustomBinder struct{}

func (*CustomBinder) Bind

func (cb *CustomBinder) Bind(i interface{}, c echo.Context) (err error)

type CustomValidatorPost

type CustomValidatorPost struct {
	Validator *validator.Validate
}

func (*CustomValidatorPost) Validate

func (cv *CustomValidatorPost) Validate(i interface{}) error

type CustomValidatorProfile

type CustomValidatorProfile struct {
	Validator *validator.Validate
}

func (*CustomValidatorProfile) Validate

func (cv *CustomValidatorProfile) Validate(i interface{}) error

type CustomValidatorSchema

type CustomValidatorSchema struct {
	Validator *validator.Validate
}

type DeniedUserListItem

type DeniedUserListItem struct {
	GroupId          string
	PeerId           string
	GroupOwnerPubkey string
	GroupOwnerSign   string
	TimeStamp        int64
	Action           string
	Memo             string
}

type DenyListParam

type DenyListParam struct {
	Action  string `from:"action" json:"action" validate:"required,oneof=add del"`
	PeerId  string `from:"peer_id"      json:"peer_id"      validate:"required"`
	GroupId string `from:"group_id"  json:"group_id"  validate:"required"`
	Memo    string `from:"memo"  json:"memo"`
}

type DenyUserResult

type DenyUserResult struct {
	GroupId          string `json:"group_id"`
	PeerId           string `json:"peer_id"`
	GroupOwnerPubkey string `json:"owner_pubkey"`
	Sign             string `json:"sign"`
	TrxId            string `json:"trx_id"`
	Action           string `json:"action"`
	Memo             string `json:"memo"`
}

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error" validate:"required"`
}

type GetTrxParam

type GetTrxParam struct {
	TrxId string `from:"trx_id" json:"trx_id" validate:"required"`
}

type GroupContentObjectItem

type GroupContentObjectItem struct {
	TrxId     string
	Publisher string
	Content   proto.Message
	TypeUrl   string
	TimeStamp int64
}

type GroupInfoList

type GroupInfoList struct {
	GroupInfos []*groupInfo `json:"groups"`
}

func (*GroupInfoList) Len

func (s *GroupInfoList) Len() int

func (*GroupInfoList) Less

func (s *GroupInfoList) Less(i, j int) bool

func (*GroupInfoList) Swap

func (s *GroupInfoList) Swap(i, j int)

type GrpProducerParam

type GrpProducerParam struct {
	Action         string `from:"action"          json:"action"           validate:"required,oneof=add remove"`
	ProducerPubkey string `from:"producer_pubkey" json:"producer_pubkey"  validate:"required"`
	GroupId        string `from:"group_id"        json:"group_id"         validate:"required"`
	Memo           string `from:"memo"            json:"memo"`
}

type GrpProducerResult

type GrpProducerResult struct {
	GroupId        string `json:"group_id"`
	ProducerPubkey string `json:"producer_pubkey"`
	OwnerPubkey    string `json:"owner_pubkey"`
	Sign           string `json:"sign"`
	TrxId          string `json:"trx_id"`
	Memo           string `json:"memo"`
	Action         string `json:"action"`
}

type Handler

type Handler struct {
	Ctx       context.Context
	Node      *p2p.Node
	NodeCtx   *nodectx.NodeCtx
	GitCommit string
	Appdb     *appdata.AppDb
}

func (*Handler) AddPeers

func (h *Handler) AddPeers(c echo.Context) (err error)

func (*Handler) Announce

func (h *Handler) Announce(c echo.Context) (err error)

func (*Handler) CreateGroup

func (h *Handler) CreateGroup(c echo.Context) (err error)

func (*Handler) GetAnnouncedGroupProducer

func (h *Handler) GetAnnouncedGroupProducer(c echo.Context) (err error)

func (*Handler) GetAnnouncedGroupUsers

func (h *Handler) GetAnnouncedGroupUsers(c echo.Context) (err error)

func (*Handler) GetBlockById

func (h *Handler) GetBlockById(c echo.Context) (err error)

func (*Handler) GetDeniedUserList

func (h *Handler) GetDeniedUserList(c echo.Context) (err error)

func (*Handler) GetGroupAppSchema

func (h *Handler) GetGroupAppSchema(c echo.Context) (err error)

func (*Handler) GetGroupCtn

func (h *Handler) GetGroupCtn(c echo.Context) (err error)

func (*Handler) GetGroupProducers

func (h *Handler) GetGroupProducers(c echo.Context) (err error)

func (*Handler) GetGroups

func (h *Handler) GetGroups(c echo.Context) (err error)

func (*Handler) GetNetwork

func (h *Handler) GetNetwork(nodehost *host.Host, nodeinfo *p2p.NodeInfo, nodeopt *options.NodeOptions, ethaddr string) echo.HandlerFunc

func (*Handler) GetNodeInfo

func (h *Handler) GetNodeInfo(c echo.Context) (err error)

func (*Handler) GetTrx

func (h *Handler) GetTrx(c echo.Context) (err error)

func (*Handler) GroupProducer

func (h *Handler) GroupProducer(c echo.Context) (err error)

func (*Handler) JoinGroup

func (h *Handler) JoinGroup(c echo.Context) (err error)

func (*Handler) LeaveGroup

func (h *Handler) LeaveGroup(c echo.Context) (err error)

func (*Handler) MgrGrpBlkList

func (h *Handler) MgrGrpBlkList(c echo.Context) (err error)

func (*Handler) PSPingPeer

func (h *Handler) PSPingPeer(node *p2p.Node) echo.HandlerFunc

func (*Handler) PostToGroup

func (h *Handler) PostToGroup(c echo.Context) (err error)

func (*Handler) RmGroup

func (h *Handler) RmGroup(c echo.Context) (err error)

func (*Handler) Schema

func (h *Handler) Schema(c echo.Context) (err error)

func (*Handler) StartSync

func (h *Handler) StartSync(c echo.Context) (err error)

func (*Handler) UpdateProfile

func (h *Handler) UpdateProfile(c echo.Context) (err error)

type JoinGroupParam

type JoinGroupParam struct {
	GenesisBlock   *chestnutpb.Block `from:"genesis_block" json:"genesis_block" validate:"required"`
	GroupId        string            `from:"group_id" json:"group_id" validate:"required"`
	GroupName      string            `from:"group_name" json:"group_name" validate:"required"`
	OwnerPubKey    string            `from:"owner_pubkey" json:"owner_pubkey" validate:"required"`
	ConsensusType  string            `from:"consensus_type" json:"consensus_type" validate:"required"`
	EncryptionType string            `from:"encryption_type" json:"encryption_type" validate:"required"`
	CipherKey      string            `from:"cipher_key" json:"cipher_key" validate:"required"`
	AppKey         string            `from:"app_key" json:"app_key" validate:"required"`
	Signature      string            `from:"signature" json:"signature" validate:"required"`
}

type JoinGroupResult

type JoinGroupResult struct {
	GroupId           string `json:"group_id"`
	GroupName         string `json:"group_name"`
	OwnerPubkey       string `json:"owner_pubkey"`
	UserPubkey        string `json:"user_pubkey"`
	UserEncryptPubkey string `json:"user_encryptpubkey"`
	ConsensusType     string `json:"consensus_type"`
	EncryptionType    string `json:"encryption_type"`
	CipherKey         string `json:"cipher_key"`
	AppKey            string `json:"app_key"`
	Signature         string `json:"signature"`
}

type LeaveGroupParam

type LeaveGroupParam struct {
	GroupId string `from:"group_id" json:"group_id" validate:"required"`
}

type LeaveGroupResult

type LeaveGroupResult struct {
	GroupId   string `json:"group_id"`
	Signature string `json:"signature"`
}

type NetworkInfo

type NetworkInfo struct {
	Peerid     string                 `json:"peerid"`
	Ethaddr    string                 `json:"ethaddr"`
	NatType    string                 `json:"nat_type"`
	NatEnabled bool                   `json:"nat_enabled"`
	Addrs      []madrr.Multiaddr      `json:"addrs"`
	Groups     []*groupNetworkInfo    `json:"groups"`
	Node       map[string]interface{} `json:"node"`
}

type NodeInfo

type NodeInfo struct {
	Node_publickey string `json:"node_publickey"`
	Node_status    string `json:"node_status"`
	Node_version   string `json:"node_version"`
	User_id        string `json:"user_id"`
}

type PSPingParam

type PSPingParam struct {
	PeerId string `from:"peer_id"      json:"peer_id"      validate:"required,max=53,min=53"`
}

type PingResult

type PingResult struct {
	Result [10]int64 `json:"pingresult"`
}

type ProducerListItem

type ProducerListItem struct {
	ProducerPubkey string
	OwnerPubkey    string
	OwnerSign      string
	TimeStamp      int64
	BlockProduced  int64
}

type RmGroupParam

type RmGroupParam struct {
	GroupId string `from:"group_id" json:"group_id" validate:"required"`
}

type RmGroupResult

type RmGroupResult struct {
	GroupId     string `json:"group_id"`
	Signature   string `json:"signature"`
	OwnerPubkey string `json:"owner_pubkey"`
}

type SchemaParam

type SchemaParam struct {
	GroupId string `from:"group_id"    json:"group_id"    validate:"required"`
	Action  string `from:"action"      json:"action"      validate:"required,oneof=add remove"`
	Type    string `from:"type"        json:"type"        validate:"required"`
	Rule    string `from:"rule"	       json:"rule"        validate:"required"`
	Memo    string `from:"memo"        json:"memo"        validate:"required"`
}

type SchemaResult

type SchemaResult struct {
	GroupId     string `json:"group_id" validate:"required"`
	OwnerPubkey string `json:"owner_pubkey" validate:"required"`
	SchemaType  string `json:"schema_type" validate:"required"`
	SchemaRule  string `json:"schema_rule" validate:"required"`
	Action      string `json:"action" validate:"required"`
	Sign        string `json:"sign" validate:"required"`
	TrxId       string `json:"trx_id" validate:"required"`
}

type StartSyncResult

type StartSyncResult struct {
	GroupId string
	Error   string
}

type TrxResult

type TrxResult struct {
	TrxId string `json:"trx_id"`
}

Directories

Path Synopsis
Package api provides APi for chestnut.
Package api provides APi for chestnut.

Jump to

Keyboard shortcuts

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