libp2p

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 55 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DHTOption       RoutingOption = constructDHTRouting(dht.ModeAuto)
	DHTClientOption               = constructDHTRouting(dht.ModeClient)
	DHTServerOption               = constructDHTRouting(dht.ModeServer)
	NilRouterOption               = constructNilRouting
)
View Source
var NatPortMap = simpleOpt(libp2p.NATPortMap())
View Source
var UserAgent = simpleOpt(libp2p.UserAgent(version.GetUserAgentVersion()))

Misc options

Functions

func AddrFilters

func AddrFilters(filters []string) func() (*ma.Filters, Libp2pOpts, error)

func AddrsFactory

func AddrsFactory(announce []string, appendAnnouce []string, noAnnounce []string) func() (opts Libp2pOpts, err error)

func AutoNATService

func AutoNATService(throttle *config.AutoNATThrottleConfig) func() Libp2pOpts

func AutoRelay added in v0.5.0

func AutoRelay(addDefaultRelays bool) func() (opts Libp2pOpts, err error)

func BaseRouting

func BaseRouting(experimentalDHTClient bool) interface{}

func ConnectionManager

func ConnectionManager(low, high int, grace time.Duration) func() (opts Libp2pOpts, err error)

func DiscoveryHandler

func DiscoveryHandler(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host) *discoveryHandler

func FloodSub

func FloodSub(pubsubOptions ...pubsub.Option) interface{}

func ForceReachability added in v0.11.0

func ForceReachability(val *config.OptionalString) func() (opts Libp2pOpts, err error)

func GossipSub

func GossipSub(pubsubOptions ...pubsub.Option) interface{}

func HolePunching added in v0.11.0

func HolePunching(flag config.Flag, hasRelayClient bool) func() (opts Libp2pOpts, err error)

func PNet

func PNet(repo repo.Repo) (opts Libp2pOpts, fp PNetFingerprint, err error)

func PNetChecker

func PNetChecker(repo repo.Repo, ph host.Host, lc fx.Lifecycle) error

func Peerstore added in v0.4.23

func Peerstore(lc fx.Lifecycle) (peerstore.Peerstore, error)

func PstoreAddSelfKeys

func PstoreAddSelfKeys(id peer.ID, sk crypto.PrivKey, ps peerstore.Peerstore) error

func PubsubRouter

func PubsubRouter(mctx helpers.MetricsCtx, lc fx.Lifecycle, in p2pPSRoutingIn) (p2pRouterOut, *namesys.PubsubValueStore, error)

func RelayService added in v0.11.0

func RelayService(enable bool, relayOpts config.RelayService) func() (opts Libp2pOpts, err error)

func RelayTransport added in v0.11.0

func RelayTransport(enableRelay bool) func() (opts Libp2pOpts, err error)

func Routing

func Routing(in p2pOnlineRoutingIn) routing.Routing

func Security

func Security(enabled bool, tptConfig config.Transports) interface{}

func SetupDiscovery

func SetupDiscovery(useMdns bool, mdnsInterval int) func(helpers.MetricsCtx, fx.Lifecycle, host.Host, *discoveryHandler) error

func SmuxTransport

func SmuxTransport(tptConfig config.Transports) func() (opts Libp2pOpts, err error)

func StartListening

func StartListening(addresses []string) func(host host.Host) error

func StaticRelays added in v0.11.0

func StaticRelays(relays []string) func() (opts Libp2pOpts, err error)

func TopicDiscovery added in v0.5.0

func TopicDiscovery() interface{}

func Transports added in v0.6.0

func Transports(tptConfig config.Transports) interface{}

Types

type BaseIpfsRouting

type BaseIpfsRouting routing.Routing

type HostOption

type HostOption func(id peer.ID, ps peerstore.Peerstore, options ...libp2p.Option) (host.Host, error)
var DefaultHostOption HostOption = constructPeerHost

type Libp2pOpts

type Libp2pOpts struct {
	fx.Out

	Opts []libp2p.Option `group:"libp2p"`
}

func BandwidthCounter

func BandwidthCounter() (opts Libp2pOpts, reporter *metrics.BandwidthCounter)

func MultiaddrResolver added in v0.9.0

func MultiaddrResolver(rslv *madns.Resolver) (opts Libp2pOpts, err error)

type P2PHostIn

type P2PHostIn struct {
	fx.In

	Repo          repo.Repo
	Validator     record.Validator
	HostOption    HostOption
	RoutingOption RoutingOption
	ID            peer.ID
	Peerstore     peerstore.Peerstore

	Opts [][]libp2p.Option `group:"libp2p"`
}

type P2PHostOut

type P2PHostOut struct {
	fx.Out

	Host    host.Host
	Routing routing.Routing `name:"initialrouting"`
}

func Host

func Host(mctx helpers.MetricsCtx, lc fx.Lifecycle, params P2PHostIn) (out P2PHostOut, err error)

type PNetFingerprint

type PNetFingerprint []byte

type Router

type Router struct {
	routing.Routing

	Priority int // less = more important
}

type RoutingOption

type RoutingOption func(
	context.Context,
	host.Host,
	datastore.Batching,
	record.Validator,
	...peer.AddrInfo,
) (routing.Routing, error)

Jump to

Keyboard shortcuts

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