Help us shape the future of Go! Take the 2026 Go Developer Survey

localnet

package
v1.23.2 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package localnet provides utilities for managing local network operations.

Index

Constants

View Source
const LocalClusterNameConst = "local-cluster"

Constants and functions

Variables

View Source
var ErrNetworkNotRunning = fmt.Errorf("network not running")

Functions

func BlockchainAlreadyDeployedOnLocalNetwork

func BlockchainAlreadyDeployedOnLocalNetwork(app *application.Lux, blockchainName string) (bool, error)

BlockchainAlreadyDeployedOnLocalNetwork checks if blockchain is deployed

func CreateLocalCluster

func CreateLocalCluster(
	app *application.Lux,
	printFn func(string, ...interface{}),
	luxdVersion string,
	binPath string,
	clusterName string,
	globalConfig map[string]interface{},
	connectionSettings ConnectionSettings,
	numNodes uint32,
	nodeSettings []NodeSetting,
	validators []interface{},
	network interface{},
	enableMonitoring bool,
	disableGrpcGateway bool,
) (interface{}, map[string]interface{}, error)

CreateLocalCluster creates a new local cluster using netrunner

func GetExtraLocalNetworkData

func GetExtraLocalNetworkData(app *application.Lux, networkName string) (interface{}, map[string]interface{}, error)

GetExtraLocalNetworkData returns extra data for local network

func GetLocalCluster

func GetLocalCluster(app *application.Lux, clusterName string) (interface{}, error)

GetLocalCluster returns a specific cluster

func GetLocalClusterDir

func GetLocalClusterDir(app *application.Lux, clusterName string) string

GetLocalClusterDir returns the directory for a local cluster

func GetLocalClusterNetworkModel

func GetLocalClusterNetworkModel(app *application.Lux, clusterName string) (models.Network, error)

GetLocalClusterNetworkModel returns the network model for a local cluster

func GetLocalClusterURIs

func GetLocalClusterURIs(app *application.Lux, clusterName string) ([]string, error)

GetLocalClusterURIs returns the URIs for a local cluster

func GetLocalClusters

func GetLocalClusters(app *application.Lux) ([]string, error)

GetLocalClusters returns all local clusters

func GetLocalNetworkDir

func GetLocalNetworkDir(app *application.Lux) string

GetLocalNetworkDir returns the directory for the local network

func GetLocalNetworkLuxdVersion

func GetLocalNetworkLuxdVersion(app *application.Lux) (string, int, bool, error)

GetLocalNetworkLuxdVersion returns the luxd version running on local network

func GetRunningLocalClustersConnectedToLocalNetwork

func GetRunningLocalClustersConnectedToLocalNetwork(app *application.Lux) ([]string, error)

GetRunningLocalClustersConnectedToLocalNetwork returns running clusters

func LoadLocalCluster

func LoadLocalCluster(app *application.Lux, clusterName string, binaryPath string) error

LoadLocalCluster loads an existing local cluster

func LocalClusterExists

func LocalClusterExists(app *application.Lux, clusterName string) bool

LocalClusterExists checks if a local cluster exists

func LocalClusterHealth

func LocalClusterHealth(app *application.Lux, clusterName string) (bool, bool, error)

LocalClusterHealth checks the health of a local cluster

func LocalClusterIsRunning

func LocalClusterIsRunning(app *application.Lux, clusterName string) (bool, error)

LocalClusterIsRunning checks if a cluster is running

func LocalClusterName

func LocalClusterName() string

LocalClusterName returns the default cluster name

func LocalClusterRemove

func LocalClusterRemove(app *application.Lux, clusterName string) error

LocalClusterRemove removes a local cluster

func LocalClusterTrackChain added in v1.13.7

func LocalClusterTrackChain(app *application.Lux, printFn func(string, ...interface{}), clusterName, blockchainName, vmID, chainID string) error

LocalClusterTrackChain tracks a chain in the local cluster

func LocalNetworkIsRunning

func LocalNetworkIsRunning(app *application.Lux) (bool, error)

LocalNetworkIsRunning checks if a local network is running

func LocalNetworkStop

func LocalNetworkStop(app *application.Lux, snapshotName ...string) error

LocalNetworkStop stops the local network

func LocalNetworkTrackChain added in v1.13.7

func LocalNetworkTrackChain(app *application.Lux, printFn func(string, ...interface{}), blockchainName, vmID string) error

LocalNetworkTrackChain tracks a chain on the local network

func PrintEndpoints

func PrintEndpoints(app *application.Lux, printFn func(string, ...interface{}), blockchainName string) error

PrintEndpoints prints the RPC endpoints for a blockchain

func RefreshLocalClusterAliases

func RefreshLocalClusterAliases(app *application.Lux, clusterName string) error

RefreshLocalClusterAliases refreshes cluster aliases

func SetupLuxdBinary

func SetupLuxdBinary(app *application.Lux, version string, binaryPath string) (string, error)

SetupLuxdBinary sets up the luxd binary for local testing

func StartLocalNetwork

func StartLocalNetwork(app *application.Lux, clusterName, nodeVersion string) error

StartLocalNetwork starts a local network

func WriteExtraLocalNetworkData

func WriteExtraLocalNetworkData(app *application.Lux, data map[string]interface{}) error

WriteExtraLocalNetworkData writes extra data for local network

Types

type BlockchainInfo

type BlockchainInfo struct {
	Name         string
	VMID         string
	BlockchainID string
	ChainID      string
}

BlockchainInfo contains information about a blockchain

func GetLocalNetworkBlockchainsInfo

func GetLocalNetworkBlockchainsInfo(app *application.Lux) ([]BlockchainInfo, error)

GetLocalNetworkBlockchainsInfo returns information about blockchains in local network

type ConnectionSettings

type ConnectionSettings struct {
	Endpoint  string
	Network   *models.Network
	NetworkID uint32
}

ConnectionSettings contains connection information for a local network

func GetLocalNetworkConnectionInfo

func GetLocalNetworkConnectionInfo(app *application.Lux) (ConnectionSettings, error)

GetLocalNetworkConnectionInfo returns connection settings for the local network

type LocalCluster added in v1.9.5

type LocalCluster struct {
	Nodes map[string]interface{}
}

LocalCluster represents a local network cluster

type NodeInfo added in v1.9.5

type NodeInfo struct {
	URI string
}

NodeInfo contains information about a node

func AddNodeToLocalCluster

func AddNodeToLocalCluster(
	app *application.Lux,
	printFn func(string, ...interface{}),
	clusterName string,
	numNodes uint32,
	network uint32,
) (NodeInfo, error)

AddNodeToLocalCluster adds a node to a local cluster

type NodeSetting

type NodeSetting struct {
	Name             string
	ConfigFile       string
	HTTPPort         uint64
	StakingPort      uint64
	StakingSignerKey []byte
	StakingCertKey   []byte
	StakingTLSKey    []byte
}

NodeSetting contains settings for a local node

type StatusChecker added in v1.9.5

type StatusChecker interface {
	GetCurrentNetworkVersion() (string, int, bool, error)
}

StatusChecker is an interface for checking network status

func NewStatusChecker added in v1.9.5

func NewStatusChecker() StatusChecker

NewStatusChecker creates a new status checker

func NewStatusCheckerWithApp added in v1.13.7

func NewStatusCheckerWithApp(app *application.Lux) StatusChecker

NewStatusCheckerWithApp creates a new status checker with app context

Jump to

Keyboard shortcuts

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