api

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2019 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logger

func Logger(l *zap.Logger) func(next http.Handler) http.Handler

Logger is a middleware that logs the start and end of each request, along with some useful data about what was requested, what the response status was, and how long it took to return.

func Run

func Run(ctx context.Context, address string, n *NodeApi) error

Types

type App

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

func NewApp

func NewApp(apiKey string, state state.State, peers peer_manager.PeerManager, scheduler SchedulerEmits, utx *utxpool.UtxImpl) (*App, error)

func (*App) BlocksFirst

func (a *App) BlocksFirst() (*proto.Block, error)

func (*App) BlocksGenerators

func (a *App) BlocksGenerators() (Generators, error)

func (*App) BlocksLast

func (a *App) BlocksLast() (*proto.Block, error)

func (*App) BlocksScoreAt

func (a *App) BlocksScoreAt(at proto.Height) (*Score, error)

func (*App) Miner

func (a *App) Miner() (*MinerInfo, error)

func (*App) PeersAll

func (a *App) PeersAll() (*PeersAll, error)

func (*App) PeersConnect

func (a *App) PeersConnect(ctx context.Context, apiKey string, addr string) (*PeersConnectResponse, error)

func (*App) PeersConnected

func (a *App) PeersConnected() (*PeersConnectedResponse, error)

func (*App) PeersSpawned

func (a *App) PeersSpawned() *PeersSpawnedResponse

func (*App) PeersSuspended

func (a *App) PeersSuspended() (*PeersSuspendedResponse, error)

func (*App) TransactionsBroadcast

func (a *App) TransactionsBroadcast(b []byte) error

type AuthError

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

type BadRequestError

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

type BlockHeightResponse

type BlockHeightResponse struct {
	Height uint64 `json:"height"`
}

type Generator

type Generator struct {
	Height proto.Height     `json:"height"`
	PubKey crypto.PublicKey `json:"pub_key"`
}

type Generators

type Generators []Generator

type InternalError

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

type MinerInfo

type MinerInfo struct {
	Scheduler Scheduler
}

type Next

type Next struct {
	PublicKey crypto.PublicKey `json:"public_key"`
	Time      time.Time        `json:"time"`
}

type NodeApi

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

func NewNodeApi

func NewNodeApi(app *App, state state.State, node *node.Node) *NodeApi

func (*NodeApi) BlockAt

func (a *NodeApi) BlockAt(w http.ResponseWriter, r *http.Request)

func (*NodeApi) BlockHeight

func (a *NodeApi) BlockHeight(w http.ResponseWriter, r *http.Request)

func (*NodeApi) BlockScoreAt

func (a *NodeApi) BlockScoreAt(w http.ResponseWriter, r *http.Request)

func (*NodeApi) BlockSignatureAt

func (a *NodeApi) BlockSignatureAt(w http.ResponseWriter, r *http.Request)

func (*NodeApi) BlocksFirst

func (a *NodeApi) BlocksFirst(w http.ResponseWriter, r *http.Request)

func (*NodeApi) BlocksGenerators

func (a *NodeApi) BlocksGenerators(w http.ResponseWriter, r *http.Request)

func (*NodeApi) BlocksLast

func (a *NodeApi) BlocksLast(w http.ResponseWriter, r *http.Request)

func (*NodeApi) Minerinfo

func (a *NodeApi) Minerinfo(w http.ResponseWriter, r *http.Request)

func (*NodeApi) PeersAll

func (a *NodeApi) PeersAll(w http.ResponseWriter, r *http.Request)

func (*NodeApi) PeersConnect

func (a *NodeApi) PeersConnect(w http.ResponseWriter, r *http.Request)

func (*NodeApi) PeersConnected

func (a *NodeApi) PeersConnected(w http.ResponseWriter, r *http.Request)

func (*NodeApi) PeersSpawned

func (a *NodeApi) PeersSpawned(w http.ResponseWriter, r *http.Request)

func (*NodeApi) PeersSuspended

func (a *NodeApi) PeersSuspended(w http.ResponseWriter, r *http.Request)

func (*NodeApi) TransactionsBroadcast

func (a *NodeApi) TransactionsBroadcast(w http.ResponseWriter, r *http.Request)

type Peer

type Peer struct {
	Address  string `json:"address"`
	LastSeen uint64 `json:"lastSeen"`
}

type PeersAll

type PeersAll struct {
	Peers []Peer `json:"peers"`
}

type PeersConnectRequest

type PeersConnectRequest struct {
	Host string `json:"host"`
	Port uint16 `json:"port"`
}

type PeersConnectResponse

type PeersConnectResponse struct {
	Hostname string `json:"hostname"`
	Status   string `json:"status"`
}

type PeersConnectedResponse

type PeersConnectedResponse struct {
	Peers []PeersConnectedRow `json:"peers"`
}

type PeersConnectedRow

type PeersConnectedRow struct {
	Address            string `json:"address"`
	DeclaredAddress    string `json:"declaredAddress"`
	PeerName           string `json:"peerName"`
	PeerNonce          uint64 `json:"peerNonce"`
	ApplicationName    string `json:"applicationName"`
	ApplicationVersion string `json:"applicationVersion"`
}

type PeersSpawnedResponse

type PeersSpawnedResponse struct {
	Peers []proto.IpPort
}

type PeersSuspendedResponse

type PeersSuspendedResponse struct {
	Peers []string `json:"peers"`
}

type Scheduler

type Scheduler struct {
	TimeNow time.Time `json:"time_now"`
	Next    []Next    `json:"next"`
}

type SchedulerEmits

type SchedulerEmits interface {
	Emits() []scheduler.Emit
}

type Score

type Score struct {
	Score string `json:"score"`
}

Jump to

Keyboard shortcuts

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