network

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultNamespace = "sl"

Variables

This section is empty.

Functions

func GetLoadbalancerHostname

func GetLoadbalancerHostname(
	serviceName string,
	namespace string,
	kubeconfig string,
) (string, error)

Types

type BitcoinNodeInterface added in v0.3.1

type BitcoinNodeInterface interface {
	GetName() string
	Generate(
		client stdbitcoinclient.BitcoinClient,
		commonClient stdcommonclient.CommonClient,
		numBlocks uint32,
	) (hashes []string, err error)
	GetWalletBalance(client stdcommonclient.CommonClient) (types.Amount, error)
	SendToAddress(
		client stdcommonclient.CommonClient,
		address string,
		amount types.Amount,
	) (TxId string, err error)
	GetNewAddress(client stdcommonclient.CommonClient) (string, error)
	GetConnectionPorts(kubeConfig string) ([]bitcoinnode.ConnectionPorts, error)
}

type CLNConnectionFiles

type CLNConnectionFiles struct {
	ClientCert []byte
	ClientKey  []byte
	CACert     []byte
}

type ConnectionDetails

type ConnectionDetails struct {
	NodeName string
	Type     string
	Host     string
	Port     uint16
}

type ConnectionFiles

type ConnectionFiles struct {
	LND *LNDConnectionFiles
	CLN *CLNConnectionFiles
}

type LNDConnectionFiles

type LNDConnectionFiles struct {
	TLSCert  []byte
	Macaroon []byte
}

type LightningNodeInterface added in v0.3.1

type LightningNodeInterface interface {
	GetName() string
	SendToAddress(
		client stdcommonclient.CommonClient,
		address string,
		amount types.Amount,
	) (string, error)
	GetNewAddress(client stdcommonclient.CommonClient) (string, error)
	GetPubKey(client stdlightningclient.LightningClient) (types.PubKey, error)
	GetWalletBalance(client stdcommonclient.CommonClient) (types.Amount, error)
	ConnectPeer(
		client stdlightningclient.LightningClient,
		pubkey types.PubKey,
		nodeName string,
	) error
	OpenChannel(
		client stdlightningclient.LightningClient,
		pubkey types.PubKey,
		localAmt types.Amount,
	) (types.ChannelPoint, error)
	GetConnectionFiles(network string, kubeConfig string) (*lightningnode.ConnectionFiles, error)
	WriteAuthFilesToDirectory(network string, kubeConfig string, dir string) error
	GetConnectionPort(kubeConfig string) (uint16, error)
	CreateInvoice(client stdlightningclient.LightningClient, amountSats uint64) (string, error)
	PayInvoice(client stdlightningclient.LightningClient, invoice string) (string, error)
	ChannelBalance(client stdlightningclient.LightningClient) (types.Amount, error)
}

type NetworkType

type NetworkType int
const (
	Mainnet NetworkType = iota
	Testnet
	Signet
	Regtest
	Simnet
)

func (NetworkType) String

func (n NetworkType) String() string

type NodeInterface added in v0.3.1

type NodeInterface interface {
	GetName() string
	GetWalletBalance(client stdcommonclient.CommonClient) (types.Amount, error)
	SendToAddress(
		client stdcommonclient.CommonClient,
		address string,
		amount types.Amount,
	) (TxId string, err error)
	GetNewAddress(client stdcommonclient.CommonClient) (string, error)
}

type SLNetwork

type SLNetwork struct {
	BitcoinNodes   []BitcoinNodeInterface
	LightningNodes []LightningNodeInterface

	ApiHost       string
	ApiPort       uint16
	Network       NetworkType
	RetryCommands bool
	RetryDelay    time.Duration
	RetryTimeout  time.Duration
	Namespace     string
	// contains filtered or unexported fields
}

func DiscoverRunningNetwork added in v0.3.1

func DiscoverRunningNetwork(
	kubeconfig string,
	overrideAPIHost string,
	overrideAPIPort uint16,
	namespace string,
) (*SLNetwork, error)

func NewSLNetwork

func NewSLNetwork(helmfile string, kubeConfig string, Network NetworkType, namespace string) (SLNetwork, error)

NewSLNetwork creates a new SLNetwork object that is used to interact with an existing network

func NewSLNetworkWithoutNamespace added in v0.4.0

func NewSLNetworkWithoutNamespace(helmfile string, kubeConfig string, Network NetworkType) (SLNetwork, error)

NewSLNetworkWithoutNamespace should be only used when creating a new network from helmfile

func (*SLNetwork) ChannelBalance added in v0.3.0

func (n *SLNetwork) ChannelBalance(nodeName string) (types.Amount, error)

func (*SLNetwork) CheckDependencies

func (n *SLNetwork) CheckDependencies() error

func (*SLNetwork) ConnectPeer added in v0.3.0

func (n *SLNetwork) ConnectPeer(fromNodeName string, toNodeName string) (string, error)

func (*SLNetwork) CreateAndStart added in v0.3.1

func (n *SLNetwork) CreateAndStart() error

func (*SLNetwork) CreateInvoice added in v0.3.0

func (n *SLNetwork) CreateInvoice(nodeName string, amountSats uint64) (string, error)

func (*SLNetwork) Destroy added in v0.3.1

func (n *SLNetwork) Destroy() error

func (*SLNetwork) Generate added in v0.3.0

func (n *SLNetwork) Generate(nodeName string, numBlocks uint32) (hashes []string, err error)

func (*SLNetwork) GetAllNodes

func (n *SLNetwork) GetAllNodes() []NodeInterface

func (*SLNetwork) GetBitcoinNode

func (n *SLNetwork) GetBitcoinNode(name string) (BitcoinNodeInterface, error)

func (*SLNetwork) GetConnectionDetails added in v0.3.0

func (n *SLNetwork) GetConnectionDetails(nodeName string) ([]ConnectionDetails, error)

func (*SLNetwork) GetConnectionDetailsForAllNodes added in v0.3.0

func (n *SLNetwork) GetConnectionDetailsForAllNodes() ([]ConnectionDetails, error)

func (*SLNetwork) GetLightningNode

func (n *SLNetwork) GetLightningNode(name string) (LightningNodeInterface, error)

func (*SLNetwork) GetNewAddress added in v0.3.0

func (n *SLNetwork) GetNewAddress(nodeName string) (string, error)

func (*SLNetwork) GetNode

func (n *SLNetwork) GetNode(name string) (NodeInterface, error)

func (*SLNetwork) GetPubKey added in v0.3.0

func (n *SLNetwork) GetPubKey(nodeName string) (types.PubKey, error)

func (*SLNetwork) GetWalletBalance added in v0.3.0

func (n *SLNetwork) GetWalletBalance(nodeName string) (types.Amount, error)

func (*SLNetwork) IsNodeRunning added in v0.3.1

func (n *SLNetwork) IsNodeRunning(nodeName string) (bool, error)

func (*SLNetwork) OpenChannel added in v0.3.0

func (n *SLNetwork) OpenChannel(
	fromNodeName string,
	toNodeName string,
	localAmountSats uint64,
) (types.ChannelPoint, error)

func (*SLNetwork) PayInvoice added in v0.3.0

func (n *SLNetwork) PayInvoice(nodeName string, invoice string) (preimage string, err error)

func (*SLNetwork) Send added in v0.3.0

func (n *SLNetwork) Send(
	fromNodeName string,
	toNodeName string,
	amountSats uint64,
) (string, error)

func (*SLNetwork) SendToAddress added in v0.4.2

func (n *SLNetwork) SendToAddress(
	fromNodeName string,
	toAddress string,
	amountSats uint64,
) (string, error)

func (*SLNetwork) Start

func (n *SLNetwork) Start() error

func (*SLNetwork) StartNode added in v0.3.1

func (n *SLNetwork) StartNode(nodeName string) error

func (*SLNetwork) Stop

func (n *SLNetwork) Stop() error

func (*SLNetwork) StopNode added in v0.3.1

func (n *SLNetwork) StopNode(nodeName string) error

Jump to

Keyboard shortcuts

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