daemon

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2018 License: MIT Imports: 24 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupDefaultDaemon

func SetupDefaultDaemon(cfg Config)

SetupDefaultDaemon sets up and starts a default daemon. The chain options and constants need to be configured prior to this. This function does not return until the daemon is stopped

func StartDaemon

func StartDaemon(cfg Config) (err error)

StartDaemon uses the config parameters to initialize Rivine modules and start

Types

type Config

type Config struct {
	BlockchainInfo types.BlockchainInfo

	// the password required to use the http api,
	// if `AuthenticateAPI` is true, and the password is the empty string,
	// a password will be prompted when the daemon starts
	APIPassword string

	// the host:port for the HTTP API to listen on.
	// If `AllowAPIBind` is false, only localhost hosts are allowed
	APIaddr string
	// the host:port to listen for RPC calls
	RPCaddr string
	// indicates that the http API can listen on a non localhost address.
	//  If this is true, then the AuthenticateAPI parameter
	// must also be true
	AllowAPIBind bool

	// the modules to enable, this string must contain one letter
	// for each module (order does not matter).
	// All required modules must be specified,
	// if a required (parent) module is not present,
	// an error is returned
	Modules string
	// indicates that the daemon should not try to connect to
	// the bootstrap nodes
	NoBootstrap bool
	// the user agent required to connect to the http api.
	RequiredUserAgent string
	// indicates if the http api is password protected
	AuthenticateAPI bool

	// indicates if profile info should be collected while
	// the daemon is running
	Profile bool
	// name of the directory to store the profile info,
	// should this be collected
	ProfileDir string
	// the parent directory where the individual module
	// directories will be created
	RootPersistentDir string

	// optional network config constructor,
	// if you're implementing your own rivine-based blockchain,
	// you'll probably want to define this one,
	// as otherwise a pure rivine blockchain config will be created,
	// within this function you should also Register any specific
	// transaction, conditions and fulfillments
	CreateNetworkConfig func(name string) (NetworkConfig, error)
}

Config contains all configurable variables for rivined.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default daemon configuration

type DaemonVersion

type DaemonVersion struct {
	Version string `json:"version"`
}

type NetworkConfig

type NetworkConfig struct {
	// Blockchain Constants for this network
	Constants types.ChainConstants
	// BootstrapPeers for this network
	BootstrapPeers []modules.NetAddress
}

NetworkConfig are variables for a particular chain. Currently, these are genesis constants and bootstrap peers

type Server

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

Server creates and serves a HTTP server that offers communication with a Sia API.

func NewServer

func NewServer(bindAddr, requiredUserAgent, requiredPassword string, chainCts types.ChainConstants, bcInfo types.BlockchainInfo) (*Server, error)

NewServer creates a new net.http server listening on bindAddr. Only the /daemon/ routes are registered by this func, additional routes can be registered later by calling serv.mux.Handle.

func (*Server) Close

func (srv *Server) Close() error

Close closes the Server's listener, causing the HTTP server to shut down.

func (*Server) Serve

func (srv *Server) Serve() error

type UpdateInfo

type UpdateInfo struct {
	Available bool   `json:"available"`
	Version   string `json:"version"`
}

UpdateInfo indicates whether an update is available, and to what version.

Jump to

Keyboard shortcuts

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