bootstrap

package
v0.2.1-0...-0bb5118 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2014 License: GPL-3.0-or-later Imports: 9 Imported by: 0

Documentation

Overview

Package bootstrap is responsible for randomly probing and linearly scanning the local network (single interface) for other running instances.

In every scanning cycle all configured UDP ports are checked (to prevent slowdowns due to large config space).

Since the heartbeats are on UDP, each one is flagged as a beat request or response (i.e. reply to requests, but don't loop indefinitely).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bootstrapper

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

Bootstrapper state for a single network interface.

func New

func New(ipnet *net.IPNet, magic []byte, node *big.Int, overlay int) (*Bootstrapper, chan *Event, error)

Creates a new bootstrapper, configuring to listen on the given interface for for incoming requests and scan the same interface for other peers. The magic is used to filter multiple Iris networks in the same physical network, while the overlay is the TCP listener port of the DHT.

func (*Bootstrapper) Boot

func (bs *Bootstrapper) Boot() error

Starts accepting bootstrap events and initiates peer discovery.

func (*Bootstrapper) SetMode

func (bs *Bootstrapper) SetMode(startup bool)

Switches between startup (fast) and maintenance (slow) sampling speeds.

func (*Bootstrapper) Terminate

func (bs *Bootstrapper) Terminate() error

Closes the bootstrap listener and terminates all probing procedures.

type Event

type Event struct {
	Peer *big.Int     // Overlay node id of the peer
	Addr *net.TCPAddr // TCP address of the peer
	Resp bool         // Flag specifying bootstrap event type
}

A direction tagged (req/resp) bootstrap event.

type Message

type Message struct {
	Version string
	Magic   []byte
	NodeId  *big.Int
	Overlay int
	Request bool
}

Bootstrap state message.

Jump to

Keyboard shortcuts

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