node

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: BSD-3-Clause Imports: 71 Imported by: 0

Documentation

Overview

Package node defines the concept of a Aurora node by bootstrapping and injecting all necessary dependencies.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNodeStopped = errors.New("node not started")
	ErrNodeRunning = errors.New("node already running")
)

Functions

func CheckOverlayWithStore

func CheckOverlayWithStore(overlay boson.Address, storer storage.StateStorer) error

CheckOverlayWithStore checks the overlay is the same as stored in the statestore

func CheckTimeouts added in v1.2.4

func CheckTimeouts(timeouts *rpc.HTTPTimeouts, log logging.Logger)

CheckTimeouts ensures that timeout values are meaningful

func InitChain

func InitChain(
	ctx context.Context,
	logger logging.Logger,
	endpoint string,
	oracleContractAddress string,
	stateStore storage.StateStorer,
	signer crypto.Signer,
	trafficEnable bool,
	trafficContractAddr string,
	p2pService *libp2p.Service,
	subPub subscribe.SubPub,
) (chain.Resolver, settlement.Interface, traffic.ApiInterface, chain.Common, error)

InitChain will initialize the Ethereum backend at the given endpoint and set up the Transacton Service to interact with it using the provided signer.

func InitStateStore

func InitStateStore(log logging.Logger, dataDir string) (ret storage.StateStorer, err error)

InitStateStore will initialize the stateStore with the given path to the data directory. When given an empty directory path, the function will instead initialize an in-memory state store that will not be persisted.

func InitTraffic added in v1.2.0

func InitTraffic(store storage.StateStorer, address common.Address, trafficChainService chain.Traffic,
	transactionService chain.Transaction, logger logging.Logger, p2pService *libp2p.Service, signer crypto.Signer, chainID int64, trafficContractAddr string, subPub subscribe.SubPub) (*traffic.Service, error)

func NewHTTPHandlerStack added in v1.2.4

func NewHTTPHandlerStack(srv http.Handler, cors []string, vhosts []string) http.Handler

NewHTTPHandlerStack returns wrapped http-related handlers

Types

type Aurora

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

func NewAurora

func NewAurora(nodeMode aurora.Model, addr string, bosonAddress boson.Address, publicKey ecdsa.PublicKey, signer crypto.Signer, networkID uint64, logger logging.Logger, libp2pPrivateKey *ecdsa.PrivateKey, o Options) (b *Aurora, err error)

func (*Aurora) Shutdown

func (b *Aurora) Shutdown(ctx context.Context) error

type Config added in v1.2.4

type Config struct {
	EnableApiTLS     bool
	TlsCrtFile       string
	TlsKeyFile       string
	DebugAPIAddr     string
	APIAddr          string
	DataDir          string
	IPCPath          string
	HTTPAddr         string
	HTTPCors         []string
	HTTPVirtualHosts []string
	HTTPModules      []string
	HTTPTimeouts     rpc.HTTPTimeouts
	HTTPPathPrefix   string
	WSAddr           string
	WSPathPrefix     string
	WSOrigins        []string
	WSModules        []string
}

type Node added in v1.2.4

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

Node is a container on which services can be registered.

func NewRPC added in v1.2.4

func NewRPC(log logging.Logger, conf Config) (*Node, error)

func (*Node) Attach added in v1.2.4

func (n *Node) Attach() (*rpc.Client, error)

Attach creates an RPC client attached to an in-process API handler.

func (*Node) Close added in v1.2.4

func (n *Node) Close() error

Close stops the Node and releases resources acquired in Node constructor New.

func (*Node) Config added in v1.2.4

func (n *Node) Config() Config

Config returns the configuration of node.

func (*Node) HTTPEndpoint added in v1.2.4

func (n *Node) HTTPEndpoint() string

HTTPEndpoint returns the URL of the HTTP server. Note that this URL does not contain the JSON-RPC path prefix set by HTTPPathPrefix.

func (*Node) IPCEndpoint added in v1.2.4

func (n *Node) IPCEndpoint() string

IPCEndpoint retrieves the current IPC endpoint used by the protocol stack.

func (*Node) RPCHandler added in v1.2.4

func (n *Node) RPCHandler() (*rpc.Server, error)

RPCHandler returns the in-process RPC request handler.

func (*Node) RegisterAPIs added in v1.2.4

func (n *Node) RegisterAPIs(apis []rpc.API)

RegisterAPIs registers the APIs a service provides on the node.

func (*Node) RegisterHandler added in v1.2.4

func (n *Node) RegisterHandler(name, path string, handler http.Handler)

RegisterHandler mounts a handler on the given path on the canonical HTTP server.

The name of the handler is shown in a log message when the HTTP server starts and should be a descriptive term for the service provided by the handler.

func (*Node) Start added in v1.2.4

func (n *Node) Start() error

Start RPC services

func (*Node) WSEndpoint added in v1.2.4

func (n *Node) WSEndpoint() string

WSEndpoint returns the current JSON-RPC over WebSocket endpoint.

func (*Node) Wait added in v1.2.4

func (n *Node) Wait()

Wait blocks until the node is closed.

type Options

type Options struct {
	DataDir               string
	CacheCapacity         uint64
	DBDriver              string
	DBPath                string
	HTTPAddr              string
	WSAddr                string
	APIAddr               string
	DebugAPIAddr          string
	ApiBufferSizeMul      int
	NATAddr               string
	EnableWS              bool
	EnableQUIC            bool
	WelcomeMessage        string
	Bootnodes             []string
	ChainEndpoint         string
	OracleContractAddress string
	CORSAllowedOrigins    []string
	Logger                logging.Logger
	Standalone            bool
	IsDev                 bool
	TracingEnabled        bool
	TracingEndpoint       string
	TracingServiceName    string
	// GlobalPinningEnabled     bool
	// PaymentThreshold         string
	// PaymentTolerance         string
	// PaymentEarly             string
	ResolverConnectionCfgs []multiresolver.ConnectionConfig
	GatewayMode            bool
	TrafficEnable          bool
	TrafficContractAddr    string
	KadBinMaxPeers         int
	LightNodeMaxPeers      int
	AllowPrivateCIDRs      bool
	Restricted             bool
	TokenEncryptionKey     string
	AdminPasswordHash      string
	RouteAlpha             int32
	Groups                 interface{}
	EnableApiTLS           bool
	TlsCrtFile             string
	TlsKeyFile             string
}

Jump to

Keyboard shortcuts

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