overlay

package module
v0.0.0-...-07264f9 Latest Latest
Warning

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

Go to latest
Published: May 2, 2019 License: Apache-2.0, MIT Imports: 19 Imported by: 0

README

go-libp2p-dht-overlay

WIP: Do not expect any results just yet...

Documentation

Overview

Package overlay spec outline

  • spin up host/peer that will be a part of the overlay network

  • spin up host/peer that will connect to public dht to perform rendezvous

  • perform rendezvous on the namespace of the overlay dht 'name', i.e. 'cat-pics-0001'

  • if there are any peers in the namespace,

  • send a 'request' to them for their associated peer address, i.e. thethe peer/host connected to the overlay dht

  • hand the responded address to the peer associated with the current peer

  • the associated peer will then perform a bootstrapping to the provided address

  • future optimizations:

  • only require the last n peers to stay in the public dht network providing the rendezvous service

  • if the number of peers in the overlay network drop below n, spin the public peer up and start rendezvous again

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StringsToAddrs

func StringsToAddrs(addrStrings []string) (maddrs []maddr.Multiaddr, err error)

StringsToAddrs ...

Types

type Config

type Config struct {
	RendezvousString       string
	BootstrapPeers         addrList
	ListenAddresses        addrList
	OverlayListenAddresses addrList
	ProtocolID             string
}

Config provides the configuration required to start the overlay nodes

type Coordinator

type Coordinator struct {
	*Identity
	Config

	PublicPeer, OverlayPeer host.Host

	PublicDHT, OverlayDHT *dht.IpfsDHT
	// contains filtered or unexported fields
}

Coordinator represents a Peer that connects to the Public DHT, a Peer that connects to an overlay DHT and the communication communication channels in between those peers.

func NewCoordinator

func NewCoordinator(ctx context.Context, config Config) (*Coordinator, error)

NewCoordinator is a constructor for the Coordinator type.

func (*Coordinator) Bootstrap

func (p *Coordinator) Bootstrap(ctx context.Context) error

Bootstrap bootstraps the public peer, connects to rendezvous peers, and then bootstraps the overlay peer.

type Identity

type Identity struct {
	PublicPrivKey  crypto.PrivKey
	OverlayPrivKey crypto.PrivKey
}

Identity is the private keys of the two peers.

func LoadIdentity

func LoadIdentity(path string) (*Identity, error)

LoadIdentity loads a json config from a path.

func (*Identity) Save

func (c *Identity) Save(path string) error

Save writes config to the provided path.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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