Documentation
¶
Overview ¶
Copyright 2020 PhysarumSM 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 ¶
const ( MaxConnAttempts = 5 // 512 seconds = 8 mins 32 secs MaxBackoffSecs = 512 )
Variables ¶
This section is empty.
Functions ¶
func ReconnectCB ¶
Returns a callback function for peer disconnection events
Given the Node and the original Config used to create it, always try to maintain its connectivity to the original bootstraps (i.e. reconnect to them if they are disconnected. Upon reconnection, re-advertise any services and/or content.
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
type Node ¶
type Node struct { Ctx context.Context Close context.CancelFunc Host host.Host DHT *dht.IpfsDHT RoutingDiscovery *discovery.RoutingDiscovery NetworkCallbacks *network.NotifyBundle }
Node is a struct that holds all libp2p related objects for a node instance