Documentation
¶
Overview ¶
Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.
Index ¶
- Constants
- Variables
- func CopyFile(src, dest string) error
- func DownloadReleaseVersion(log luxlog.Logger, repo, version, binDir string) (string, error)deprecated
- func GetAsyncContext() context.Context
- func GetBackendLogFile(app *application.Lux) (string, error)
- func GetGithubLatestReleaseURL(org, repo string) string
- func GetServerPID(app *application.Lux) (int, error)
- func GetServerPIDForNetwork(app *application.Lux, networkType string) (int, error)
- func InstallArchive(ext string, archive []byte, binDir string) error
- func InstallBinary(app *application.Lux, version string, baseBinDir string, installDir string, ...) (string, error)
- func IsServerProcessRunningForNetwork(app *application.Lux, networkType string) (bool, error)
- func KillgRPCServerProcess(app *application.Lux) error
- func KillgRPCServerProcessForNetwork(app *application.Lux, networkType string) error
- func NewGRPCClient(opts ...GRPCClientOpOption) (client.Client, error)
- func NewGRPCServer(snapshotsDir string) (server.Server, error)
- func NewGRPCServerForNetwork(snapshotsDir, networkType string) (server.Server, error)
- func NewLedgerAdapter() (keychain.Ledger, error)
- func NewLoggerAdapter(logger log.Logger) log.Logger
- func SetupCustomBin(app *application.Lux, subnetName string) string
- func SetupEVM(app *application.Lux, evmVersion string) (string, error)
- func SetupLPMBin(app *application.Lux, vmid string) string
- func SetupLux(app *application.Lux, luxdVersion string) (string, error)
- func SetupLuxgo(app *application.Lux, luxdVersion string) (string, error)
- func StartServerProcess(app *application.Lux) error
- func StartServerProcessForNetwork(app *application.Lux, networkType string) error
- func UpdateLocalSidecarRPC(app *application.Lux, sc models.Sidecar, rpcVersion int) error
- func UpgradeVM(app *application.Lux, vmID string, vmBinPath string) error
- func WatchServerProcess(serverCancel context.CancelFunc, errc chan error, logger luxlog.Logger)
- type BinaryChecker
- type GRPCClientOp
- type GRPCClientOpOption
- type GithubDownloader
- type Installer
- type LedgerAdapter
- func (l *LedgerAdapter) Address(displayHRP string, addressIndex uint32) (ids.ShortID, error)
- func (l *LedgerAdapter) Addresses(addressIndices []uint32) ([]ids.ShortID, error)
- func (l *LedgerAdapter) Disconnect() error
- func (l *LedgerAdapter) GetAddresses(addressIndices []uint32) ([]ids.ShortID, error)
- func (l *LedgerAdapter) Sign(unsignedTxBytes []byte, addressIndex uint32) ([]byte, error)
- func (l *LedgerAdapter) SignHash(hash []byte, addressIndex uint32) ([]byte, error)
- func (l *LedgerAdapter) SignTransaction(unsignedTxBytes []byte, addressIndices []uint32) ([][]byte, error)
- func (l *LedgerAdapter) Version() (*version.Semantic, error)
- type NetworkGRPCPorts
- type PluginBinaryDownloader
- type ProcessChecker
Constants ¶
const ( GRPCPortMainnet = constants.GRPCPortMainnet GRPCPortTestnet = constants.GRPCPortTestnet GRPCPortDevnet = constants.GRPCPortDevnet GRPCPortCustom = constants.GRPCPortCustom GRPCGatewayPortMainnet = constants.GRPCGatewayPortMainnet GRPCGatewayPortTestnet = constants.GRPCGatewayPortTestnet GRPCGatewayPortDevnet = constants.GRPCGatewayPortDevnet GRPCGatewayPortCustom = constants.GRPCGatewayPortCustom )
Re-export port constants from centralized package
Variables ¶
var ErrGRPCTimeout = errors.New("timed out trying to contact backend controller, it is most probably not running")
ErrGRPCTimeout is a common error message if the gRPC server can't be reached
Functions ¶
func DownloadReleaseVersion
deprecated
DownloadReleaseVersion returns the latest available version from github for the given repo and version, and installs it into the apps `bin` dir. NOTE: If any of the underlying URLs change (github changes, release file names, etc.) this fails The goal MUST be to have some sort of mature binary management
Deprecated: Use GetLatestReleaseVersion
func GetAsyncContext ¶
GetAsyncContext returns a timeout context with the cancel function suppressed
func GetBackendLogFile ¶
func GetBackendLogFile(app *application.Lux) (string, error)
func GetServerPID ¶
func GetServerPID(app *application.Lux) (int, error)
func GetServerPIDForNetwork ¶ added in v1.21.42
func GetServerPIDForNetwork(app *application.Lux, networkType string) (int, error)
GetServerPIDForNetwork returns the server PID for a specific network type.
func InstallArchive ¶
InstallArchive installs the binary archive downloaded
func InstallBinary ¶
func InstallBinary( app *application.Lux, version string, baseBinDir string, installDir string, binPrefix, org, repo string, downloader GithubDownloader, installer Installer, ) (string, error)
func IsServerProcessRunningForNetwork ¶ added in v1.21.42
func IsServerProcessRunningForNetwork(app *application.Lux, networkType string) (bool, error)
IsServerProcessRunningForNetwork checks if a network-specific gRPC server is running.
func KillgRPCServerProcess ¶
func KillgRPCServerProcess(app *application.Lux) error
KillgRPCServerProcess kills the default (mainnet) gRPC server. Deprecated: Use KillgRPCServerProcessForNetwork instead.
func KillgRPCServerProcessForNetwork ¶ added in v1.21.42
func KillgRPCServerProcessForNetwork(app *application.Lux, networkType string) error
KillgRPCServerProcessForNetwork kills a network-specific gRPC server.
func NewGRPCClient ¶
func NewGRPCClient(opts ...GRPCClientOpOption) (client.Client, error)
NewGRPCClient hides away the details (params) of creating a gRPC server connection
func NewGRPCServer ¶
NewGRPCServer creates a gRPC server with default ports (for backward compatibility)
func NewGRPCServerForNetwork ¶ added in v1.21.42
NewGRPCServerForNetwork creates a gRPC server with network-specific ports
func NewLedgerAdapter ¶
NewLedgerAdapter creates a new ledger adapter
func NewLoggerAdapter ¶
NewLoggerAdapter returns the logger directly since luxfi/log.Logger already implements the interface
func SetupCustomBin ¶
func SetupCustomBin(app *application.Lux, subnetName string) string
func SetupLPMBin ¶
func SetupLPMBin(app *application.Lux, vmid string) string
func SetupLux ¶
func SetupLux(app *application.Lux, luxdVersion string) (string, error)
SetupLux is an alias for SetupLuxgo for backward compatibility
func SetupLuxgo ¶
func SetupLuxgo(app *application.Lux, luxdVersion string) (string, error)
func StartServerProcess ¶
func StartServerProcess(app *application.Lux) error
StartServerProcess starts the gRPC server as a reentrant process of this binary for the default network type (mainnet). Deprecated: Use StartServerProcessForNetwork instead.
func StartServerProcessForNetwork ¶ added in v1.21.42
func StartServerProcessForNetwork(app *application.Lux, networkType string) error
StartServerProcessForNetwork starts a network-specific gRPC server. Each network type (mainnet, testnet, local) gets its own server on a dedicated port. This allows running multiple networks simultaneously. The server process is named based on network type (e.g., lux-mainnet-grpc, lux-testnet-grpc) for easy identification with ps/top commands.
func UpdateLocalSidecarRPC ¶
update the RPC version of the VM in the sidecar file
func WatchServerProcess ¶
func WatchServerProcess(serverCancel context.CancelFunc, errc chan error, logger luxlog.Logger)
Types ¶
type BinaryChecker ¶
type BinaryChecker interface {
ExistsWithVersion(name, binaryPrefix, version string) (bool, error)
}
func NewBinaryChecker ¶
func NewBinaryChecker() BinaryChecker
type GRPCClientOp ¶
type GRPCClientOp struct {
// contains filtered or unexported fields
}
type GRPCClientOpOption ¶
type GRPCClientOpOption func(*GRPCClientOp)
func WithAvoidRPCVersionCheck ¶
func WithAvoidRPCVersionCheck(avoidRPCVersionCheck bool) GRPCClientOpOption
func WithEndpoint ¶ added in v1.21.42
func WithEndpoint(endpoint string) GRPCClientOpOption
WithEndpoint sets a custom gRPC endpoint for the client
func WithNetworkType ¶ added in v1.21.42
func WithNetworkType(networkType string) GRPCClientOpOption
WithNetworkType configures the client to use the gRPC port for a specific network type
type GithubDownloader ¶
type GithubDownloader interface {
GetDownloadURL(version string, installer Installer) (string, string, error)
}
func NewEVMDownloader ¶
func NewEVMDownloader() GithubDownloader
func NewLuxDownloader ¶
func NewLuxDownloader() GithubDownloader
func NewLuxdDownloader ¶
func NewLuxdDownloader() GithubDownloader
NewLuxdDownloader is an alias for NewLuxDownloader for compatibility
type Installer ¶
func NewInstaller ¶
func NewInstaller() Installer
type LedgerAdapter ¶
type LedgerAdapter struct {
// contains filtered or unexported fields
}
LedgerAdapter wraps ledger.LedgerLux to implement keychain.Ledger interface
func (*LedgerAdapter) Addresses ¶
func (l *LedgerAdapter) Addresses(addressIndices []uint32) ([]ids.ShortID, error)
Addresses returns multiple addresses at the given indices
func (*LedgerAdapter) Disconnect ¶
func (l *LedgerAdapter) Disconnect() error
Disconnect closes the connection to the ledger device
func (*LedgerAdapter) GetAddresses ¶ added in v1.9.4
func (l *LedgerAdapter) GetAddresses(addressIndices []uint32) ([]ids.ShortID, error)
GetAddresses is an alias for Addresses to satisfy the interface
func (*LedgerAdapter) Sign ¶
func (l *LedgerAdapter) Sign(unsignedTxBytes []byte, addressIndex uint32) ([]byte, error)
Sign signs transaction bytes with a single address index
func (*LedgerAdapter) SignHash ¶
func (l *LedgerAdapter) SignHash(hash []byte, addressIndex uint32) ([]byte, error)
SignHash signs a hash with a single address index
func (*LedgerAdapter) SignTransaction ¶ added in v1.9.4
func (l *LedgerAdapter) SignTransaction(unsignedTxBytes []byte, addressIndices []uint32) ([][]byte, error)
SignTransaction signs transaction bytes with multiple address indices
type NetworkGRPCPorts ¶ added in v1.21.42
type NetworkGRPCPorts = constants.NetworkGRPCPorts
NetworkGRPCPorts is an alias to centralized type for backward compatibility
func GetGRPCPorts ¶ added in v1.21.42
func GetGRPCPorts(networkType string) NetworkGRPCPorts
GetGRPCPorts delegates to centralized constants package
type PluginBinaryDownloader ¶
type PluginBinaryDownloader interface {
InstallVM(vmID, vmBin string) error
UpgradeVM(vmID, vmBin string) error
RemoveVM(vmID string) error
}
func NewPluginBinaryDownloader ¶
func NewPluginBinaryDownloader(app *application.Lux) PluginBinaryDownloader
type ProcessChecker ¶
type ProcessChecker interface {
// IsServerProcessRunning returns true if the gRPC server is running,
// or false if not
IsServerProcessRunning(app *application.Lux) (bool, error)
}
ProcessChecker is responsible for checking if the gRPC server is running
func NewProcessChecker ¶
func NewProcessChecker() ProcessChecker
NewProcessChecker creates a new process checker which can respond if the server is running