lp2p

package
v1.29.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: Apache-2.0, MIT Imports: 64 Imported by: 12

Documentation

Index

Constants

View Source
const (
	KLibp2pHost                = "libp2p-host"
	KTLibp2pHost types.KeyType = KLibp2pHost
)
View Source
const (
	GossipScoreThreshold             = -500
	PublishScoreThreshold            = -1000
	GraylistScoreThreshold           = -2500
	AcceptPXScoreThreshold           = 1000
	OpportunisticGraftScoreThreshold = 3.5

	// Determines the max. number of configuration changes
	// that are allowed for the dynamic manifest.
	// If the manifest changes more than this number, the F3
	// message topic will be filtered
	MaxDynamicManifestChangesAllowed = 1000
)

Variables

View Source
var AutoNATService = simpleOpt(libp2p.EnableNATService())
View Source
var DefaultTransports = simpleOpt(libp2p.DefaultTransports)
View Source
var NatPortMap = simpleOpt(libp2p.NATPortMap())
View Source
var QUIC = simpleOpt(libp2p.Transport(libp2pquic.NewTransport))

Functions

func AddrsFactory

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

func BaseRouting

func BaseRouting(lc fx.Lifecycle, in BaseIpfsRouting) (out p2pRouterOut, dr *dht.IpfsDHT)

func ConnGater added in v1.2.2

func ConnectionManager

func ConnectionManager(low, high uint, grace time.Duration, protected []string) func() (opts Libp2pOpts, err error)

func DHTRouting

func DHTRouting(mode dht.ModeOpt) interface{}

func Discovery

func Discovery(router BaseIpfsRouting) (coredisc.Discovery, error)

func DiscoveryHandler

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

func GossipSub

func GossipSub(in GossipIn) (service *pubsub.PubSub, err error)

func HashMsgId added in v0.3.0

func HashMsgId(m *pubsub_pb.Message) string

func MakeAddrsFactory added in v1.15.1

func MakeAddrsFactory(announce []string, noAnnounce []string) (p2pbhost.AddrsFactory, error)

func NoRelay added in v0.3.1

func NoRelay() func() (opts Libp2pOpts, err error)

func Peerstore added in v1.14.0

func Peerstore() (peerstore.Peerstore, error)

func PrivKey

func PrivKey(ks types.KeyStore) (crypto.PrivKey, error)

func PstoreAddSelfKeys

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

func ResourceManager added in v1.14.0

func ResourceManager(connMgrHi uint) func(lc fx.Lifecycle, repo repo.LockedRepo, bs dtypes.BootstrapPeers) (network.ResourceManager, error)

func RoutedHost

func RoutedHost(rh RawHost, r BaseIpfsRouting) host.Host

func Routing

func Routing(in p2pOnlineRoutingIn) routing.Routing

func ScoreKeeper added in v0.3.1

func ScoreKeeper() *dtypes.ScoreKeeper

func Security

func Security(enabled, preferTLS bool) interface{}

func SmuxTransport

func SmuxTransport() func() (opts Libp2pOpts, err error)

func StartListening

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

func UserAgentOption added in v1.23.0

func UserAgentOption(agent string) func() (opts Libp2pOpts, err error)

Types

type BaseIpfsRouting

type BaseIpfsRouting routing.Routing

func NilRouting

func NilRouting(mctx helpers.MetricsCtx) (BaseIpfsRouting, error)

type Libp2pOpts

type Libp2pOpts struct {
	fx.Out

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

func BandwidthCounter

func BandwidthCounter(lc fx.Lifecycle, id peer.ID) (opts Libp2pOpts, reporter metrics.Reporter, err error)

func ConnGaterOption added in v1.2.2

func ConnGaterOption(cg *conngater.BasicConnectionGater) (opts Libp2pOpts, err error)

func ResourceManagerOption added in v1.14.0

func ResourceManagerOption(mgr network.ResourceManager) Libp2pOpts

type P2PHostIn

type P2PHostIn struct {
	fx.In

	ID        peer.ID
	Peerstore peerstore.Peerstore

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

type PeerScoreTracker added in v1.20.0

type PeerScoreTracker interface {
	UpdatePeerScore(scores map[peer.ID]*pubsub.PeerScoreSnapshot)
}

type RawHost

type RawHost host.Host

func Host

func Host(mctx helpers.MetricsCtx, buildVersion build.BuildVersion, lc fx.Lifecycle, params P2PHostIn) (RawHost, error)

func MockHost

func MockHost(mn mocknet.Mocknet, id peer.ID, ps peerstore.Peerstore) (RawHost, error)

type Router

type Router struct {
	routing.Routing

	Priority int // less = more important
}

Jump to

Keyboard shortcuts

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