discovery

package
v0.0.0-...-f05ad83 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2019 License: Apache-2.0 Imports: 25 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NetworkInfo

type NetworkInfo struct {
	Manifest []byte
	Genesis  []byte
	Image    io.ReadCloser
}

NetworkInfo represents a network.

func (*NetworkInfo) Project

func (n *NetworkInfo) Project() (*project.Project, error)

Project returns a project object from the network info.

func (*NetworkInfo) WriteManifest

func (n *NetworkInfo) WriteManifest(dst string) error

WriteManifest writes the manifest file to dst

type PeerInfo

type PeerInfo struct {
	NodeID            string   `json:"node_id"`
	IP                []string `json:"ips"`
	TendermintP2PPort int      `json:"tendermint_p2p_port"`
}

PeerInfo contains information about one peer.

type Server

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

Server is the discovery server

func New

func New(root string, port int) *Server

New returns a new discovery server

func (*Server) Announce

func (s *Server) Announce(ctx context.Context, chainID string, peer *PeerInfo) error

Announce announces our presence as a network node.

func (*Server) Join

func (s *Server) Join(ctx context.Context, chainID string) (*NetworkInfo, error)

Join joins a network.

func (*Server) Peers

func (s *Server) Peers(ctx context.Context, chainID string) (<-chan *PeerInfo, error)

Peers looks for peers in the network

func (*Server) Publish

func (s *Server) Publish(ctx context.Context, manifestPath, genesisPath, imagePath string) (string, error)

Publish publishes chain information. Returns the chain ID.

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start starts the discovery server

func (*Server) Stop

func (s *Server) Stop() error

Stop must be called after start

Jump to

Keyboard shortcuts

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