virtual_network

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressSendCoins added in v0.8.15

func AddressSendCoins(ctx context.Context, cli *client.Client,
	container dockercontainer.ContainerCreateCreatedBody, address string, amt string) (txId string, err error)

func CheckPeerExists

func CheckPeerExists(ctx context.Context, cli *client.Client, container dockercontainer.ContainerCreateCreatedBody,
	remotePubkey string) (bool, error)

func CloseChannel

func CloseChannel(ctx context.Context, cli *client.Client, container dockercontainer.ContainerCreateCreatedBody,
	channelPoint string) (closeTxId string, err error)

func ConnectPeer

func ConnectPeer(ctx context.Context, cli *client.Client, container dockercontainer.ContainerCreateCreatedBody,
	remotePubkey string, remoteIPAddress string) error

func CreateChannel

func CreateChannel(ctx context.Context, cli *client.Client, container dockercontainer.ContainerCreateCreatedBody,
	remotePubkey string, amount string, btcd dockercontainer.ContainerCreateCreatedBody) (channelPoint string, err error)

func CreateNewVirtualNetwork

func CreateNewVirtualNetwork(name string, createDatabase bool, purge bool) error

CreateNewVirtualNetwork creates a new virtual network with the given name, this is used for creating the development Lightning network and database.

func ExecCommand

func ExecCommand(ctx context.Context, cli *client.Client,
	container dockercontainer.ContainerCreateCreatedBody,
	cmd []string) (bufStdout bytes.Buffer, bufStderr bytes.Buffer, err error)

func ExecJSONReturningCommand

func ExecJSONReturningCommand(ctx context.Context, cli *client.Client,
	container dockercontainer.ContainerCreateCreatedBody,
	cmd []string, returnObject interface{}) error

func GenerateInvoice

func GenerateInvoice(ctx context.Context, cli *client.Client,
	container dockercontainer.ContainerCreateCreatedBody, amount string) (encodedInvoice string, err error)

func GetChannelBalance

func GetChannelBalance(ctx context.Context, cli *client.Client,
	container dockercontainer.ContainerCreateCreatedBody) (balance string, err error)

func GetNewAddress

func GetNewAddress(ctx context.Context, cli *client.Client, instance dockercontainer.ContainerCreateCreatedBody) (addr string, err error)

func GetOnchainBalance

func GetOnchainBalance(ctx context.Context, cli *client.Client, container dockercontainer.ContainerCreateCreatedBody) (balance string, err error)

func GetPubKey

func GetPubKey(ctx context.Context, cli *client.Client, container dockercontainer.ContainerCreateCreatedBody) (pubkey string, err error)

func ListNodeChannels added in v0.8.15

func ListNodeChannels(ctx context.Context, cli *client.Client,
	container dockercontainer.ContainerCreateCreatedBody, pubkey string) (channels []string, err error)

func MineBlocks

func MineBlocks(ctx context.Context, cli *client.Client, container dockercontainer.ContainerCreateCreatedBody,
	numberOfBlocks int) error

func NodeFLowLoop added in v0.8.15

func NodeFLowLoop(name string, invfrq int, scofrq int, ochfrq int) error

NodeFLowLoop Run a loop that - creates and pays invoices to/from random nodes at a user defined interval - creates addresses and sends coins from/to random nodes at a user defined interval - opens a channel between random nodes at user defined interval -no more than 2 duplicate channels - closes channels randomly invfrq flag = invoice creation frequency - default to 1 time per second sendcoins flag = create address and sencoins frequency - default to 1 time per 30 seconds openChan flag = open channel frequency - default to 1 time per 10 minutes

func PayInvoice

func PayInvoice(ctx context.Context, cli *client.Client,
	container dockercontainer.ContainerCreateCreatedBody, invoice string) error

func PrintInstructions

func PrintInstructions()

func PurgeVirtualNetwork

func PurgeVirtualNetwork(name string, withDatabase bool) error

func Retry

func Retry(operation func() error, delayMilliseconds int, maxWaitMilliseconds int) error

func StartVirtualNetwork

func StartVirtualNetwork(name string, withDatabase bool) error

func StopVirtualNetwork

func StopVirtualNetwork(name string, withDatabase bool) error

func WriteConnectionDetails

func WriteConnectionDetails(ctx context.Context, cli *client.Client, name string, nodeIp string) error

Types

type ContainerConfig

type ContainerConfig struct {
	Name       string
	Image      string
	Env        []string
	Binds      []string
	Cmd        []string
	MappedPort string
	Instance   dockercontainer.ContainerCreateCreatedBody
}

type DockerDevEnvironment

type DockerDevEnvironment struct {
	Client           *client.Client
	NetworkName      string
	NetworkingConfig network.NetworkingConfig
	Containers       map[string]*ContainerConfig
	SharedVolumeName string
}

func (*DockerDevEnvironment) AddContainer

func (de *DockerDevEnvironment) AddContainer(name string, image string, binds []string, env []string, cmd []string,
	mappedPort string) *ContainerConfig

func (*DockerDevEnvironment) BuildImage

func (de *DockerDevEnvironment) BuildImage(ctx context.Context, path string, name string) error

func (*DockerDevEnvironment) CleanupContainers

func (de *DockerDevEnvironment) CleanupContainers(ctx context.Context) error

func (*DockerDevEnvironment) CleanupDefaultVolumes

func (de *DockerDevEnvironment) CleanupDefaultVolumes(ctx context.Context) error

func (*DockerDevEnvironment) CreateContainer

func (de *DockerDevEnvironment) CreateContainer(ctx context.Context, container *ContainerConfig) (err error)

func (*DockerDevEnvironment) CreateNetwork

func (de *DockerDevEnvironment) CreateNetwork(ctx context.Context) (nc network.NetworkingConfig, err error)

func (*DockerDevEnvironment) FindAndRemoveContainer

func (de *DockerDevEnvironment) FindAndRemoveContainer(ctx context.Context, name string) error

func (*DockerDevEnvironment) FindAndRemoveNetwork

func (de *DockerDevEnvironment) FindAndRemoveNetwork(ctx context.Context, name string) error

func (*DockerDevEnvironment) FindAndRemoveVolume

func (de *DockerDevEnvironment) FindAndRemoveVolume(ctx context.Context, name string) error

func (*DockerDevEnvironment) FindContainerByName

func (de *DockerDevEnvironment) FindContainerByName(ctx context.Context, name string) (*types.Container, error)

func (*DockerDevEnvironment) FindNetworkByName

func (de *DockerDevEnvironment) FindNetworkByName(ctx context.Context, name string) (*types.NetworkResource, error)

func (*DockerDevEnvironment) FindVolumeByName

func (de *DockerDevEnvironment) FindVolumeByName(ctx context.Context, name string) (*types.Volume, error)

func (*DockerDevEnvironment) InitContainer

func (de *DockerDevEnvironment) InitContainer(ctx context.Context, container *ContainerConfig) error

func (*DockerDevEnvironment) StartContainer

func (de *DockerDevEnvironment) StartContainer(ctx context.Context, cc *ContainerConfig) (err error)

func (*DockerDevEnvironment) StopContainer

func (de *DockerDevEnvironment) StopContainer(ctx context.Context, name string) (err error)

type ErrorDetail

type ErrorDetail struct {
	Message string `json:"message"`
}

type ErrorLine

type ErrorLine struct {
	Error       string      `json:"error"`
	ErrorDetail ErrorDetail `json:"errorDetail"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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