p2pnode

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Copyright 2020 Multi-Tier-Cloud Development Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

View Source
const (
	MaxConnAttempts = 5
)

Variables

This section is empty.

Functions

func StringsToMultiaddrs

func StringsToMultiaddrs(stringMultiaddrs []string) ([]multiaddr.Multiaddr, error)

Helper function to cast a slice of strings into a slice of Multiaddrs

Types

type Config

type Config struct {
	PrivKey            crypto.PrivKey
	ListenAddrs        []string
	BootstrapPeers     []multiaddr.Multiaddr
	StreamHandlers     []network.StreamHandler
	HandlerProtocolIDs []protocol.ID
	Rendezvous         []string
	PSK                pnet.PSK
}

Config is a structure for passing arguments into Node constructor NewNode

func NewConfig

func NewConfig() Config

Config constructor that returns default configuration

type Node

type Node struct {
	Ctx              context.Context
	Host             host.Host
	DHT              *dht.IpfsDHT
	RoutingDiscovery *discovery.RoutingDiscovery
}

Node is a struct that holds all libp2p related objects for a node instance

func NewNode

func NewNode(ctx context.Context, config Config) (Node, error)

Node constructor

Jump to

Keyboard shortcuts

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