bootstrap

package module
v0.0.0-...-23cbec1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2015 License: MIT Imports: 12 Imported by: 2

README

Bootstrap

Bootstrap implements an object with which both trusted and secure peers can be bootstrapped to an existing network.

Documentation

Overview

Package bootstrap implements the capability to connect to an existing and online Tinzenite peer network.

TODO: add encryption bootstrap capabilities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bootstrap

type Bootstrap struct {
	// contains filtered or unexported fields
}

Bootstrap is a temporary peer object that allows to bootstrap into an existing Tinzenite network. Also it is CORRECT and DESIRED that a model for a trusted peer +is not stored between runs to allow resetting if something goes wrong.

func Create

func Create(path, localPeerName string, trusted bool, f Success) (*Bootstrap, error)

Create returns a struct that will allow to bootstrap to an existing Tinzenite network. To actually start bootstrapping call Bootstrap.Start(address).

Path: the absolute path to the directory. localPeerName: the user defined name of this peer. trusted: whether this should be a trusted peer or an encrypted one. f: the callback to call once the bootstrap has successfully run.

func Load

func Load(path string, f Success) (*Bootstrap, error)

Load tries to load the given directory as a bootstrap object, allowing it to connect to an existing network. To actually start bootstrapping call Bootstrap.Start(address). NOTE: will fail if already connected to other peers!

func (*Bootstrap) Address

func (b *Bootstrap) Address() (string, error)

Address returns the full address of this peer.

func (*Bootstrap) Close

func (b *Bootstrap) Close()

Close cleanly closes everything underlying.

func (*Bootstrap) IsTrusted

func (b *Bootstrap) IsTrusted() bool

IsTrusted can be used to read whether this bootstrap is creating an encrypted or a trusted peer.

func (*Bootstrap) PrintStatus

func (b *Bootstrap) PrintStatus() string

PrintStatus returns a formatted string of the peer status.

func (*Bootstrap) Start

func (b *Bootstrap) Start(address string) error

Start begins a bootstrap process to the given address.

func (*Bootstrap) Store

func (b *Bootstrap) Store() error

Store writes a bootstrapped .TINZENITEDIR to disk. Call this if you want persistant bootstrapping (and why wouldn't you?).

type Success

type Success func()

Success is the callback that will be called once the bootstrap is complete.

Jump to

Keyboard shortcuts

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