config

package
v0.0.0-...-09e90c6 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//DefaultIPFSAPIPort DefaultIPFSAPIPort
	DefaultIPFSAPIPort = 5001
	// DefaultIPFSGatewayPort DefaultIPFSGatewayPort
	DefaultIPFSGatewayPort = 8080
	// DefaultIPFSSwarmPort DefaultIPFSSwarmPort
	DefaultIPFSSwarmPort = 4001

	// IPVersion default ip version
	IPVersion string = "/ip4/"
	// TransportProtocol default transport protocol
	TransportProtocol string = "/tcp/"
)

Variables

This section is empty.

Functions

func CreateEmptyDir

func CreateEmptyDir(path string) error

CreateEmptyDir create an empty directory at the given path

func EditIPFSConfig

func EditIPFSConfig(path, ip string)

EditIPFSConfig edit the ipfs configuration file (mainly the ip)

func EditIPFSField

func EditIPFSField(path, field, value string)

EditIPFSField with the native IPFS config command

func GetClusterVariables

func GetClusterVariables(path, ip, secret, peername string,
	replmin, replmax int, ports ClusterInstance) string

GetClusterVariables get the cluster variables

func GetEnvVar

func GetEnvVar(field, value string) string

GetEnvVar get the environnment variable for the given field and value

func GetNextAvailablePorts

func GetNextAvailablePorts(pmin, pmax, n int) (*[]int, error)

GetNextAvailablePorts return n available ports between pmin and pmax crash if error

func MakeJSONArray

func MakeJSONArray(elements []string) string

MakeJSONArray make a json array from the given elements

func MakeJSONElem

func MakeJSONElem(elem string) string

MakeJSONElem make a JSON single element

func Protocol

func Protocol(configPath, nodeID, ip string, replmin, replmax int) error

Protocol to start all clusters in an ARA

func ReadConfig

func ReadConfig(file string) (string, error)

ReadConfig read a config file given as parameter and returns a string

func SaveInstances

func SaveInstances(instances []ClusterInstance, filename string)

SaveInstances save ipfs and ipfs-cluster instances ip and ports on disk

func SetClusterLeaderConfig

func SetClusterLeaderConfig(path, ip, peername string,
	replmin, replmax int, ports ClusterInstance) (
	string, string, error)

SetClusterLeaderConfig set the configs for the leader of a cluster

func WriteConfig

func WriteConfig(path string, config string) error

WriteConfig write string to a file

Types

type ClusterInstance

type ClusterInstance struct {
	IP            string
	IPFSAPIPort   int
	RestAPIPort   int
	IPFSProxyPort int
	ClusterPort   int
}

ClusterInstance details of a cluster

func LoadInstances

func LoadInstances(filename string) []ClusterInstance

LoadInstances load saved ipfs and ipfs-cluster instances from disk

func SetupClusterLeader

func SetupClusterLeader(configPath, nodeID, ip string,
	replmin, replmax int) (string, *ClusterInstance, error)

SetupClusterLeader setup a cluster instance for the ARA leader

func SetupClusterSlave

func SetupClusterSlave(configPath, nodeID, ip, bootstrap, secret string,
	replmin, replmax int) (*ClusterInstance, error)

SetupClusterSlave setup a cluster slave instance

Jump to

Keyboard shortcuts

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