Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// A node's name must be unique from all other nodes
// in a network. If Name is the empty string, a
// unique name is assigned on node creation.
Name string `json:"name"`
// True if other nodes should use this node
// as a bootstrap beacon.
IsBeacon bool `json:"isBeacon"`
// Must not be nil.
StakingKey string `json:"stakingKey"`
// Must not be nil.
StakingCert string `json:"stakingCert"`
// Must not be nil.
StakingSigningKey string `json:"stakingSigningKey"`
// May be nil.
ConfigFile string `json:"configFile"`
// May be nil.
ChainConfigFiles map[string]string `json:"chainConfigFiles"`
// May be nil.
UpgradeConfigFiles map[string]string `json:"upgradeConfigFiles"`
// May be nil. P-Chain chain (formerly subnet) config files.
PChainConfigFiles map[string]string `json:"pChainConfigFiles"`
// Flags can hold additional flags for the node.
// It can be empty.
// The precedence of flags handling is:
// 1. Flags defined in node.Config (this struct) override
// 2. Flags defined in network.Config override
// 3. Flags defined in the json config file
Flags map[string]interface{} `json:"flags"`
// What type of node this is
BinaryPath string `json:"binaryPath"`
// If non-nil, direct this node's Stdout to os.Stdout
RedirectStdout bool `json:"redirectStdout"`
// If non-nil, direct this node's Stderr to os.Stderr
RedirectStderr bool `json:"redirectStderr"`
}
Config encapsulates an node configuration
type Node ¶
type Node interface {
// Return this node's name, which is unique
// across all the nodes in its network.
GetName() string
// Return this node's Lux node ID.
GetNodeID() ids.NodeID
// Return a client that can be used to make API calls.
GetAPIClient() api.Client
// Return this node's host/IP (e.g. 127.0.0.1).
GetHost() string
// Return this node's full HTTP API URL (e.g. http://127.0.0.1:9630).
GetURL() string
// Return this node's P2P (staking) port.
GetP2PPort() uint16
// Return this node's HTTP API port.
GetAPIPort() uint16
// Starts a new test peer, connects it to the given node, and returns the peer.
// [handler] defines how the test peer handles messages it receives.
// The test peer can be used to send messages to the node it's attached to.
// It's left to the caller to maintain a reference to the returned peer.
// The caller should call StartClose() on the peer when they're done with it.
AttachPeer(ctx context.Context, handler router.InboundHandler) (peer.Peer, error)
// Sends a message from the attached peer to the node
SendOutboundMessage(ctx context.Context, peerID string, content []byte, op uint32) (bool, error)
// Return the state of the node process
Status() status.Status
// Return this node's node binary path
GetBinaryPath() string
// Return this node's data dir
GetDataDir() string
// Return this node's db dir
GetDbDir() string
// Return this node's logs dir
GetLogsDir() string
// Return this node's plugin dir
GetPluginDir() string
// Return this node's config file contents
GetConfigFile() string
// Return this node's config
GetConfig() Config
// Return this node's flag value
GetFlag(string) (string, error)
// Return this node's paused status
GetPaused() bool
}
Node represents an Lux node
Click to show internal directories.
Click to hide internal directories.