iptbutil

package
v1.3.9 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2018 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTimeout = errors.New("timeout")

Functions

func ApplyConfigOverride

func ApplyConfigOverride(cfg *InitCfg) error

func ConnectNodes

func ConnectNodes(from, to IpfsNode, timeout string) error

func GetAttrDescr

func GetAttrDescr(attr string) (string, error)

func GetListOfAttr

func GetListOfAttr() []string

func GetNumNodes

func GetNumNodes() int

GetNumNodes returns the number of testbed nodes configured in the testbed directory

func GetPeerID

func GetPeerID(ipfsdir string) (string, error)

GetPeerID reads the config of node 'n' and returns its peer ID

func IpfsDirN

func IpfsDirN(n int) (string, error)

func IpfsInit

func IpfsInit(cfg *InitCfg) error

func IpfsKillAll

func IpfsKillAll(nds []IpfsNode) error

func IpfsStart

func IpfsStart(nodes []IpfsNode, waitall bool, args []string) error

func TestBedDir

func TestBedDir() (string, error)

func WriteNodeSpecs

func WriteNodeSpecs(specs []*NodeSpec) error

func YesNoPrompt

func YesNoPrompt(prompt string) bool

Types

type BW

type BW struct {
	TotalIn  int
	TotalOut int
}

func GetBW

func GetBW(n IpfsNode) (*BW, error)

type DockerNode

type DockerNode struct {
	ImageName string
	ID        string

	LocalNode
	// contains filtered or unexported fields
}

DockerNode is an IPFS node in a docker container controlled by IPTB

func (*DockerNode) APIAddr

func (dn *DockerNode) APIAddr() (string, error)

func (*DockerNode) GetAttr

func (dn *DockerNode) GetAttr(name string) (string, error)

func (*DockerNode) Kill

func (dn *DockerNode) Kill() error

func (*DockerNode) RunCmd

func (dn *DockerNode) RunCmd(args ...string) (string, error)

func (*DockerNode) SetAttr

func (dn *DockerNode) SetAttr(name, val string) error

func (*DockerNode) Shell

func (dn *DockerNode) Shell() error

func (*DockerNode) Start

func (dn *DockerNode) Start(args []string) error

func (*DockerNode) String

func (dn *DockerNode) String() string

type InitCfg

type InitCfg struct {
	Count     int
	Force     bool
	Bootstrap string
	PortStart int
	Mdns      bool
	Utp       bool
	Websocket bool
	Override  string
	NodeType  string
}

type IpfsNode

type IpfsNode interface {
	Init() error
	Kill() error
	Start(args []string) error
	APIAddr() (string, error)
	GetPeerID() string
	RunCmd(args ...string) (string, error)
	Shell() error
	String() string

	GetAttr(string) (string, error)
	SetAttr(string, string) error

	GetConfig() (*config.Config, error)
	WriteConfig(*config.Config) error
}

IpfsNode defines the interface iptb requires to work with an IPFS node

func LoadNodeN

func LoadNodeN(n int) (IpfsNode, error)

func LoadNodes

func LoadNodes() ([]IpfsNode, error)

func NodesFromSpecs

func NodesFromSpecs(specs []*NodeSpec) ([]IpfsNode, error)

type LocalNode

type LocalNode struct {
	Dir    string
	PeerID string
}

LocalNode is a machine-local IPFS node controlled by IPTB

func (*LocalNode) APIAddr

func (n *LocalNode) APIAddr() (string, error)

func (*LocalNode) GetAttr

func (n *LocalNode) GetAttr(attr string) (string, error)

func (*LocalNode) GetConfig

func (n *LocalNode) GetConfig() (*config.Config, error)

func (*LocalNode) GetPeerID

func (n *LocalNode) GetPeerID() string

func (*LocalNode) Init

func (n *LocalNode) Init() error

func (*LocalNode) Kill

func (n *LocalNode) Kill() error

func (*LocalNode) RunCmd

func (n *LocalNode) RunCmd(args ...string) (string, error)

func (*LocalNode) SetAttr

func (n *LocalNode) SetAttr(name, val string) error

func (*LocalNode) Shell

func (n *LocalNode) Shell() error

Shell sets up environment variables for a new shell to more easily control the given daemon

func (*LocalNode) Start

func (n *LocalNode) Start(args []string) error

func (*LocalNode) StderrReader added in v1.1.7

func (n *LocalNode) StderrReader() (io.ReadCloser, error)

func (*LocalNode) StdoutReader added in v1.1.7

func (n *LocalNode) StdoutReader() (io.ReadCloser, error)

func (*LocalNode) String

func (n *LocalNode) String() string

func (*LocalNode) WriteConfig

func (n *LocalNode) WriteConfig(c *config.Config) error

type NodeSpec

type NodeSpec struct {
	Type  string
	Dir   string
	Extra map[string]interface{}
}

func ReadNodeSpecs

func ReadNodeSpecs() ([]*NodeSpec, error)

func (*NodeSpec) Load

func (ns *NodeSpec) Load() (IpfsNode, error)

Jump to

Keyboard shortcuts

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