go-ipfs: github.com/ipfs/go-ipfs/peering Index | Files

package peering

import "github.com/ipfs/go-ipfs/peering"

Index

Package Files

peering.go

type PeeringService Uses

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

PeeringService maintains connections to specified peers, reconnecting on disconnect with a back-off.

func NewPeeringService Uses

func NewPeeringService(host host.Host) *PeeringService

NewPeeringService constructs a new peering service. Peers can be added and removed immediately, but connections won't be formed until `Start` is called.

func (*PeeringService) AddPeer Uses

func (ps *PeeringService) AddPeer(info peer.AddrInfo)

AddPeer adds a peer to the peering service. This function may be safely called at any time: before the service is started, while running, or after it stops.

Add peer may also be called multiple times for the same peer. The new addresses will replace the old.

func (*PeeringService) RemovePeer Uses

func (ps *PeeringService) RemovePeer(id peer.ID)

RemovePeer removes a peer from the peering service. This function may be safely called at any time: before the service is started, while running, or after it stops.

func (*PeeringService) Start Uses

func (ps *PeeringService) Start() error

Start starts the peering service, connecting and maintaining connections to all registered peers. It returns an error if the service has already been stopped.

func (*PeeringService) Stop Uses

func (ps *PeeringService) Stop() error

Stop stops the peering service.

Package peering imports 10 packages (graph) and is imported by 8 packages. Updated 2020-06-06. Refresh now. Tools for package owners.