ngp2p

package
v0.0.0-...-8d08d5c Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Overview

Package ngp2p is the ngin p2p protocol implement based on libp2p

ngp2p uses libp2p(ipfs)'s dht for public peer discovery and mDNS for private, and uses pub-sub to work the broadcast net

the main peer-to-peer communication is based on Wired Protocol, which uses fast protobuf to encode and decode objects

Index

Constants

This section is empty.

Variables

View Source
var BootstrapNodes []multiaddr.Multiaddr

BootstrapNodes is a list of all bootstrap nodes

Functions

This section is empty.

Types

type LocalNode

type LocalNode struct {
	host.Host // lib-p2p host

	P2PConfig P2PConfig

	*wired.Wired
	*broadcast.Broadcast
	// contains filtered or unexported fields
}

LocalNode is the local host on p2p network

func InitLocalNode

func InitLocalNode(chain *ngchain.Chain, config P2PConfig) *LocalNode

InitLocalNode creates a new node with its implemented protocols.

func (*LocalNode) GoServe

func (localNode *LocalNode) GoServe()

type P2PConfig

type P2PConfig struct {
	P2PKeyFile       string
	Network          ngtypes.NetworkType
	Port             int
	DisableDiscovery bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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