Documentation ¶
Overview ¶
Package core defines Indigo Node's core functionality.
Index ¶
- Constants
- Variables
- func BuiltinServices() []manager.Service
- func Deps(services []manager.Service, configSet cfg.ConfigSet, servID string) (deps []string, err error)
- func Fgraph(w io.Writer, services []manager.Service, configSet cfg.ConfigSet, ...) error
- func LoadConfig(set cfg.Set, filename string) error
- func NewConfigurableSet(services []manager.Service) cfg.Set
- func PrettyLog(filename, level, system string, follow, json, color bool) error
- type Config
- type ConfigHandler
- type Core
- type Opt
- type ServiceGroupConfig
Constants ¶
const ConfigVersionKey = "core.configuration_version"
ConfigVersionKey is the key of the configuration version number in the TOML file.
Variables ¶
var DefaultConfig = Config{ ConfigVersion: len(migrations), BootService: "boot", ServiceGroups: []ServiceGroupConfig{{ ID: "boot", Name: "Boot Services", Desc: "Starts boot services.", Services: []string{"system", "bootstrap", "api", "util"}, }, { ID: "system", Name: "System Services", Desc: "Starts system services.", Services: []string{"signal", "pruner", "monitoring"}, }, { ID: "p2p", Name: "P2P Services", Desc: "Starts P2P services.", Services: []string{"identify", "relay", "kaddht", "ping", "clock", "pubsub"}, }, { ID: "network", Name: "Network Services", Desc: "Starts network services.", Services: []string{"host", "natmgr"}, }, { ID: "api", Name: "API Services", Desc: "Starts API services.", Services: []string{"grpcapi", "grpcweb"}, }, { ID: "util", Name: "Utility Services", Desc: "Starts utility services.", Services: []string{"contacts", "event"}, }, { ID: "indigo", Name: "Stratumn Indigo Services", Desc: "Starts Stratumn Indigo services for Proof-of-Process networks.", Services: []string{"indigostore", "indigofossilizer"}, }}, EnableBootScreen: true, BootScreenHost: "host", }
DefaultConfig is the default core configuration.
var ( // ErrInvalidConfig is returned when the configuration is invalid. ErrInvalidConfig = errors.New("the configuration is invalid") )
Functions ¶
func BuiltinServices ¶
BuiltinServices returns all the builtin services.
func Deps ¶
func Deps( services []manager.Service, configSet cfg.ConfigSet, servID string, ) (deps []string, err error)
Deps returns the dependencies of a service in the order they would be started with the given configuration.
The returned slice ends with the service itself.
If no service ID is given, the boot service will be used.
func Fgraph ¶
func Fgraph( w io.Writer, services []manager.Service, configSet cfg.ConfigSet, servID string, ) error
Fgraph prints the dependency graph of a service given the current configuration to a writer.
If no service ID is given, the boot service will be used.
func LoadConfig ¶
LoadConfig loads the configuration file and applies migrations.
func NewConfigurableSet ¶
NewConfigurableSet creates a new set of configurables bound to the given services. If no services are given, the builtin services are used.
Types ¶
type Config ¶
type Config struct { // ConfigVersion is the version of the configuration file. ConfigVersion int `toml:"configuration_version" comment:"The version of the configuration file."` // BootService is the service to launch when starting the node. BootService string `toml:"boot_service" comment:"Service to launch when starting the node."` // ServiceGroups are groups of services that can be started as a // service. ServiceGroups []ServiceGroupConfig `toml:"service_groups" comment:"Groups of services."` // EnableBootScreen is whether to show the boot screen when starting // the node. EnableBootScreen bool `toml:"enable_boot_screen" comment:"Whether to show the boot screen when starting the node."` // BootScreenHost is the name of the host service used by the // boot screen to display metrics and host addresses. BootScreenHost string `toml:"boot_screen_host" comment:"Name of the host service used by the boot screen to display metrics and host addresses."` }
Config contains the core settings.
type ConfigHandler ¶
type ConfigHandler struct {
// contains filtered or unexported fields
}
ConfigHandler is a configurable for the core settings.
func (*ConfigHandler) Config ¶
func (c *ConfigHandler) Config() interface{}
Config returns the current service configuration or creates one with good default values.
func (*ConfigHandler) ID ¶
func (c *ConfigHandler) ID() string
ID returns the unique identifier of the service.
func (*ConfigHandler) SetConfig ¶
func (c *ConfigHandler) SetConfig(config interface{}) error
SetConfig configures the service handler.
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
Core manages a node. It wraps a service manager, and can display a boot screen showing services being started and node metrics.
type Opt ¶
type Opt func(*Core)
Opt is a core option.
func OptManager ¶
OptManager sets the service manager.
If this option is not given, a new manager is created.
func OptMetricsHandler ¶
func OptMetricsHandler(h func()) Opt
OptMetricsHandler sets a function that will be called everytime metrics tick.
This is useful for tests.
func OptServices ¶
OptServices adds services.
If this option is not given, the builtin services are used.
func OptStderr ¶
OptStderr sets the writer for the boot screen error output.
If this option is not given, os.Stderr is used.
func OptStdout ¶
OptStdout sets the writer for the boot screen normal output.
If this option is not given, os.Stdout is used.
func OptUpHandler ¶
func OptUpHandler(h func()) Opt
OptUpHandler sets a function that will be called once the node has started.
This is useful for tests.
type ServiceGroupConfig ¶
type ServiceGroupConfig struct { // ID is the unique identifier of the group. ID string `toml:"id" comment:"Unique identifier of the service group."` // Name is the name of the group. Name string `toml:"name" comment:"Name of the service group."` // Desc is the description of the group. Desc string `toml:"description" comment:"Description of the service group."` // Services are the services that the group starts. Services []string `toml:"services" comment:"Services started by the group."` }
ServiceGroupConfig contains settings for a service group.
Directories ¶
Path | Synopsis |
---|---|
app
|
|
bootstrap
Package bootstrap defines a core service that bootstraps a host from a set of well known peers or from a private network.
|
Package bootstrap defines a core service that bootstraps a host from a set of well known peers or from a private network. |
bootstrap/grpc
Package grpc is a generated protocol buffer package.
|
Package grpc is a generated protocol buffer package. |
bootstrap/pb
Package pb is a generated protocol buffer package.
|
Package pb is a generated protocol buffer package. |
bootstrap/protocol
Package protocol implements the network bootstrapping protocols.
|
Package protocol implements the network bootstrapping protocols. |
bootstrap/protocol/mockprotocol
Package mockprotocol is a generated GoMock package.
|
Package mockprotocol is a generated GoMock package. |
bootstrap/protocol/proposal
Package proposal implements a store for network update proposals.
|
Package proposal implements a store for network update proposals. |
bootstrap/protocol/proposal/mocks
Package mockproposal is a generated GoMock package.
|
Package mockproposal is a generated GoMock package. |
bootstrap/service
Package service defines the bootstrap service implementation.
|
Package service defines the bootstrap service implementation. |
bootstrap/service/mockservice
Package mockservice is a generated GoMock package.
|
Package mockservice is a generated GoMock package. |
connmgr/service
Package service defines a service that manages the number of connections kept open.
|
Package service defines a service that manages the number of connections kept open. |
event/grpc
Package grpc is a generated protocol buffer package.
|
Package grpc is a generated protocol buffer package. |
event/grpc/mockgrpc
Package mockgrpc is a generated GoMock package.
|
Package mockgrpc is a generated GoMock package. |
event/service/mockservice
Package mockservice is a generated GoMock package.
|
Package mockservice is a generated GoMock package. |
grpcapi/grpc
Package grpc is a generated protocol buffer package.
|
Package grpc is a generated protocol buffer package. |
grpcapi/service
Package service defines a service that exposes a gRPC API.
|
Package service defines a service that exposes a gRPC API. |
grpcapi/service/mockservice
Package mockservice is a generated GoMock package.
|
Package mockservice is a generated GoMock package. |
grpcweb/service
Package service wraps the grpcapi server to implement the gRPC-Web spec
|
Package service wraps the grpcapi server to implement the gRPC-Web spec |
host/grpc/mockgrpc
Package mockgrpc is a generated GoMock package.
|
Package mockgrpc is a generated GoMock package. |
host/service
Package service defines a service the wraps a P2P host.
|
Package service defines a service the wraps a P2P host. |
identify/service
Package service defines a service that identifies peers on the network.
|
Package service defines a service that identifies peers on the network. |
identify/service/mockservice
Package mockservice is a generated GoMock package.
|
Package mockservice is a generated GoMock package. |
kaddht/service
Package service defines a service that runs an instance of a Kademlia distributed hash table server or client that can be used to route peer IDs to network addresses.
|
Package service defines a service that runs an instance of a Kademlia distributed hash table server or client that can be used to route peer IDs to network addresses. |
kaddht/service/mockservice
Package mockservice is a generated GoMock package.
|
Package mockservice is a generated GoMock package. |
monitoring/grpc
Package grpc is a generated protocol buffer package.
|
Package grpc is a generated protocol buffer package. |
monitoring/service
Package service defines a service to configure monitoring for your Indigo Node.
|
Package service defines a service to configure monitoring for your Indigo Node. |
mssmux/service
Package service defines a service that routes transport protocols to stream multiplexers.
|
Package service defines a service that routes transport protocols to stream multiplexers. |
natmgr/service
Package service defines a service that deals with setting NAT port mappings to allow nodes to connect to a node behind a firewall.
|
Package service defines a service that deals with setting NAT port mappings to allow nodes to connect to a node behind a firewall. |
natmgr/service/mockservice
Package mockservice is a generated GoMock package.
|
Package mockservice is a generated GoMock package. |
ping/grpc
Package grpc is a generated protocol buffer package.
|
Package grpc is a generated protocol buffer package. |
ping/grpc/mockgrpc
Package mockgrpc is a generated GoMock package.
|
Package mockgrpc is a generated GoMock package. |
ping/service
Package service defines a service that handles ping requests and responses.
|
Package service defines a service that handles ping requests and responses. |
pruner/service
Package service defines a service that periodically prunes the service manager.
|
Package service defines a service that periodically prunes the service manager. |
pruner/service/mockservice
Package mockservice is a generated GoMock package.
|
Package mockservice is a generated GoMock package. |
pubsub/service
Package pubsub provides publish-subscribe capabilities that other apps can leverage.
|
Package pubsub provides publish-subscribe capabilities that other apps can leverage. |
relay/service
Package service defines a service for the P2P relay circuit, which enables nodes to send traffic through intermediary nodes in order to reach otherwise inaccessible nodes.
|
Package service defines a service for the P2P relay circuit, which enables nodes to send traffic through intermediary nodes in order to reach otherwise inaccessible nodes. |
signal/service
Package service defines a service that deals with exit signals.
|
Package service defines a service that deals with exit signals. |
signal/service/mockservice
Package mockservice is a generated GoMock package.
|
Package mockservice is a generated GoMock package. |
swarm/grpc/mockgrpc
Package mockgrpc is a generated GoMock package.
|
Package mockgrpc is a generated GoMock package. |
swarm/service
Package service defines a service that maintains a swarm of connections between this node and its peers.
|
Package service defines a service that maintains a swarm of connections between this node and its peers. |
yamux/service
Package service defines a service for the Yamux stream multiplexer.
|
Package service defines a service for the Yamux stream multiplexer. |
Package cfg provides a simple mechanism for creating and loading configuration files.
|
Package cfg provides a simple mechanism for creating and loading configuration files. |
Package crypto is a generated protocol buffer package.
|
Package crypto is a generated protocol buffer package. |
Package httputil provides an utility method to start an HTTP server in the context of an Indigo Node service.
|
Package httputil provides an utility method to start an HTTP server in the context of an Indigo Node service. |
mockhttputil
Package mockhttputil is a generated GoMock package.
|
Package mockhttputil is a generated GoMock package. |
Package log deals with logging.
|
Package log deals with logging. |
Package manager deals with managing services.
|
Package manager deals with managing services. |
grpc
Package grpc is a generated protocol buffer package.
|
Package grpc is a generated protocol buffer package. |
grpc/mockgrpc
Package mockgrpc is a generated GoMock package.
|
Package mockgrpc is a generated GoMock package. |
mockmanager
Package mockmanager is a generated GoMock package.
|
Package mockmanager is a generated GoMock package. |
testservice
Package testservice defines types to help test services.
|
Package testservice defines types to help test services. |
Package monitoring contains thin wrappers around the monitoring libraries used.
|
Package monitoring contains thin wrappers around the monitoring libraries used. |
Package netutil defines useful networking types.
|
Package netutil defines useful networking types. |
Package p2p defines types for P2P networking.
|
Package p2p defines types for P2P networking. |
Package protector contains implementations of the github.com/libp2p/go-libp2p-interface-pnet/ipnet.Protector interface.
|
Package protector contains implementations of the github.com/libp2p/go-libp2p-interface-pnet/ipnet.Protector interface. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
Package streamutil provides utility functions to make handling streams easier.
|
Package streamutil provides utility functions to make handling streams easier. |
mockstream
Package mockstream is a generated GoMock package.
|
Package mockstream is a generated GoMock package. |