go-libp2p: github.com/libp2p/go-libp2p/p2p/host/routed Index | Files

package routedhost

import "github.com/libp2p/go-libp2p/p2p/host/routed"

Index

Package Files

routed.go

Constants

const AddressTTL = time.Second * 10

AddressTTL is the expiry time for our addresses. We expire them quickly.

type RoutedHost Uses

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

RoutedHost is a p2p Host that includes a routing system. This allows the Host to find the addresses for peers when it does not have them.

func Wrap Uses

func Wrap(h host.Host, r Routing) *RoutedHost

func (*RoutedHost) Addrs Uses

func (rh *RoutedHost) Addrs() []ma.Multiaddr

func (*RoutedHost) Close Uses

func (rh *RoutedHost) Close() error

func (*RoutedHost) ConnManager Uses

func (rh *RoutedHost) ConnManager() connmgr.ConnManager

func (*RoutedHost) Connect Uses

func (rh *RoutedHost) Connect(ctx context.Context, pi peer.AddrInfo) error

Connect ensures there is a connection between this host and the peer with given peer.ID. See (host.Host).Connect for more information.

RoutedHost's Connect differs in that if the host has no addresses for a given peer, it will use its routing system to try to find some.

func (*RoutedHost) ID Uses

func (rh *RoutedHost) ID() peer.ID

func (*RoutedHost) Mux Uses

func (rh *RoutedHost) Mux() protocol.Switch

func (*RoutedHost) Network Uses

func (rh *RoutedHost) Network() network.Network

func (*RoutedHost) NewStream Uses

func (rh *RoutedHost) NewStream(ctx context.Context, p peer.ID, pids ...protocol.ID) (network.Stream, error)

func (*RoutedHost) Peerstore Uses

func (rh *RoutedHost) Peerstore() peerstore.Peerstore

func (*RoutedHost) RemoveStreamHandler Uses

func (rh *RoutedHost) RemoveStreamHandler(pid protocol.ID)

func (*RoutedHost) SetStreamHandler Uses

func (rh *RoutedHost) SetStreamHandler(pid protocol.ID, handler network.StreamHandler)

func (*RoutedHost) SetStreamHandlerMatch Uses

func (rh *RoutedHost) SetStreamHandlerMatch(pid protocol.ID, m func(string) bool, handler network.StreamHandler)

type Routing Uses

type Routing interface {
    FindPeer(context.Context, peer.ID) (peer.AddrInfo, error)
}

Package routedhost imports 13 packages (graph) and is imported by 34 packages. Updated 2019-06-06. Refresh now. Tools for package owners.