Documentation
¶
Index ¶
- Constants
- Variables
- func AddrFilters(filters []string) func() (*ma.Filters, Libp2pOpts, error)
- func AddrsFactory(announce []string, appendAnnounce []string, noAnnounce []string) interface{}
- func AutoNATService(throttle *config.AutoNATThrottleConfig, v1only bool) func() Libp2pOpts
- func BaseRouting(cfg *config.Config) interface{}
- func ConnectionManager(low, high int, grace, silence time.Duration) func() (opts Libp2pOpts, err error)
- func ContentDiscovery(in irouting.ProvideManyRouter) routing.ContentDiscovery
- func ContentRouting(in p2pOnlineContentRoutingIn) routing.ContentRouting
- func DiscoveryHandler(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host) *discoveryHandler
- func FloodSub(pubsubOptions ...pubsub.Option) interface{}
- func ForceReachability(val *config.OptionalString) func() (opts Libp2pOpts, err error)
- func GossipSub(pubsubOptions ...pubsub.Option) interface{}
- func HolePunching(flag config.Flag, hasRelayClient bool) func() (opts Libp2pOpts, err error)
- func LimitConfig(cfg config.SwarmConfig, userResourceOverrides rcmgr.PartialLimitConfig) (limitConfig rcmgr.ConcreteLimitConfig, logMessageForStartup string, err error)
- func ListenOn(addresses []string) interface{}
- func MaybeAutoRelay(staticRelays []string, cfgPeering config.Peering, enabled bool) fx.Option
- func OfflineRouting(dstore ds.Datastore, validator record.Validator) p2pRouterOut
- func P2PForgeCertMgr(repoPath string, cfg config.AutoTLS, atlsLog *logging.ZapEventLogger) interface{}
- func PNet(repo repo.Repo) (opts Libp2pOpts, fp PNetFingerprint, err error)
- func PNetChecker(repo repo.Repo, ph host.Host, lc fx.Lifecycle) error
- func Peerstore(lc fx.Lifecycle) (peerstore.Peerstore, error)
- func PstoreAddSelfKeys(id peer.ID, sk crypto.PrivKey, ps peerstore.Peerstore) error
- func PubsubRouter(mctx helpers.MetricsCtx, lc fx.Lifecycle, in p2pPSRoutingIn) (p2pRouterOut, *namesys.PubsubValueStore, error)
- func RelayService(enable bool, relayOpts config.RelayService) func() (opts Libp2pOpts, err error)
- func RelayTransport(enableRelay bool) func() (opts Libp2pOpts, err error)
- func ResourceManager(repoPath string, cfg config.SwarmConfig, ...) interface{}
- func Routing(in p2pOnlineRoutingIn) irouting.ProvideManyRouter
- func Security(enabled bool, tptConfig config.Transports) interface{}
- func SetupDiscovery(useMdns bool) func(helpers.MetricsCtx, fx.Lifecycle, host.Host, *discoveryHandler) error
- func SmuxTransport(tptConfig config.Transports) func() (opts Libp2pOpts, err error)
- func StartP2PAutoTLS(lc fx.Lifecycle, certMgr *p2pforge.P2PForgeCertMgr, h host.Host)
- func TopicDiscovery() interface{}
- func Transports(tptConfig config.Transports) interface{}
- func UserAgent() func() (opts Libp2pOpts, err error)
- type AddrInfoChan
- type EndpointSource
- type HostOption
- type Libp2pOpts
- type LimitsConfigAndUsage
- type P2PHostIn
- type P2PHostOut
- type PNetFingerprint
- type ResourceInfo
- type ResourceInfos
- type ResourceLimitsAndUsage
- type Router
- type RoutingOption
- type RoutingOptionArgs
Constants ¶
const NetLimitTraceFilename = "rcmgr.json.gz"
Variables ¶
var ( DHTOption RoutingOption = constructDHTRouting(dht.ModeAuto) DHTClientOption = constructDHTRouting(dht.ModeClient) DHTServerOption = constructDHTRouting(dht.ModeServer) NilRouterOption = constructNilRouting )
var ErrNoResourceMgr = errors.New("missing ResourceMgr: make sure the daemon is running with Swarm.ResourceMgr.Enabled")
var NatPortMap = simpleOpt(libp2p.NATPortMap())
Functions ¶
func AddrFilters ¶
func AddrFilters(filters []string) func() (*ma.Filters, Libp2pOpts, error)
func AddrsFactory ¶
func AutoNATService ¶
func AutoNATService(throttle *config.AutoNATThrottleConfig, v1only bool) func() Libp2pOpts
func BaseRouting ¶
func ConnectionManager ¶
func ConnectionManager(low, high int, grace, silence time.Duration) func() (opts Libp2pOpts, err error)
func ContentDiscovery ¶ added in v0.37.0
func ContentDiscovery(in irouting.ProvideManyRouter) routing.ContentDiscovery
ContentDiscovery narrows down the given content routing facility so that it only does discovery.
func ContentRouting ¶
func ContentRouting(in p2pOnlineContentRoutingIn) routing.ContentRouting
ContentRouting will get all routers that can do contentRouting and add them all together using a TieredRouter. It will be used for topic discovery.
func DiscoveryHandler ¶
func ForceReachability ¶
func ForceReachability(val *config.OptionalString) func() (opts Libp2pOpts, err error)
func HolePunching ¶
func HolePunching(flag config.Flag, hasRelayClient bool) func() (opts Libp2pOpts, err error)
func LimitConfig ¶ added in v0.19.0
func LimitConfig(cfg config.SwarmConfig, userResourceOverrides rcmgr.PartialLimitConfig) (limitConfig rcmgr.ConcreteLimitConfig, logMessageForStartup string, err error)
LimitConfig returns the union of the Computed Default Limits and the User Supplied Override Limits.
func MaybeAutoRelay ¶ added in v0.16.0
func OfflineRouting ¶
OfflineRouting provides a special Router to the routers list when we are creating an offline node.
func P2PForgeCertMgr ¶ added in v0.32.0
func P2PForgeCertMgr(repoPath string, cfg config.AutoTLS, atlsLog *logging.ZapEventLogger) interface{}
func PNet ¶
func PNet(repo repo.Repo) (opts Libp2pOpts, fp PNetFingerprint, err error)
func PstoreAddSelfKeys ¶
func PubsubRouter ¶
func PubsubRouter(mctx helpers.MetricsCtx, lc fx.Lifecycle, in p2pPSRoutingIn) (p2pRouterOut, *namesys.PubsubValueStore, error)
func RelayService ¶
func RelayService(enable bool, relayOpts config.RelayService) func() (opts Libp2pOpts, err error)
func RelayTransport ¶
func RelayTransport(enableRelay bool) func() (opts Libp2pOpts, err error)
func ResourceManager ¶
func ResourceManager(repoPath string, cfg config.SwarmConfig, userResourceOverrides rcmgr.PartialLimitConfig) interface{}
func Routing ¶
func Routing(in p2pOnlineRoutingIn) irouting.ProvideManyRouter
Routing will get all routers obtained from different methods (delegated routers, pub-sub, and so on) and add them all together using a ParallelRouter.
func Security ¶
func Security(enabled bool, tptConfig config.Transports) interface{}
func SetupDiscovery ¶
func SmuxTransport ¶
func SmuxTransport(tptConfig config.Transports) func() (opts Libp2pOpts, err error)
func StartP2PAutoTLS ¶ added in v0.32.0
func TopicDiscovery ¶
func TopicDiscovery() interface{}
func Transports ¶
func Transports(tptConfig config.Transports) interface{}
func UserAgent ¶
func UserAgent() func() (opts Libp2pOpts, err error)
Types ¶
type AddrInfoChan ¶
type EndpointSource ¶ added in v0.37.0
type EndpointSource struct { URL string SupportsRead bool // came from DelegatedRoutersWithAutoConf (Read operations) SupportsWrite bool // came from DelegatedPublishersWithAutoConf (Write operations) }
EndpointSource tracks where a URL came from to determine appropriate capabilities
type HostOption ¶
type HostOption func(id peer.ID, ps peerstore.Peerstore, options ...libp2p.Option) (host.Host, error)
var DefaultHostOption HostOption = constructPeerHost
type Libp2pOpts ¶
func BandwidthCounter ¶
func BandwidthCounter() (opts Libp2pOpts, reporter *metrics.BandwidthCounter)
func MultiaddrResolver ¶
func MultiaddrResolver(rslv *madns.Resolver) (opts Libp2pOpts, err error)
type LimitsConfigAndUsage ¶ added in v0.19.0
type LimitsConfigAndUsage struct { // This is duplicated from rcmgr.ResourceManagerStat but using ResourceLimitsAndUsage // instead of network.ScopeStat. System ResourceLimitsAndUsage `json:",omitempty"` Transient ResourceLimitsAndUsage `json:",omitempty"` Services map[string]ResourceLimitsAndUsage `json:",omitempty"` Protocols map[protocol.ID]ResourceLimitsAndUsage `json:",omitempty"` Peers map[peer.ID]ResourceLimitsAndUsage `json:",omitempty"` }
func MergeLimitsAndStatsIntoLimitsConfigAndUsage ¶ added in v0.19.0
func MergeLimitsAndStatsIntoLimitsConfigAndUsage(l rcmgr.ConcreteLimitConfig, stats rcmgr.ResourceManagerStat) LimitsConfigAndUsage
func (LimitsConfigAndUsage) MarshalJSON ¶ added in v0.19.0
func (u LimitsConfigAndUsage) MarshalJSON() ([]byte, error)
func (LimitsConfigAndUsage) ToPartialLimitConfig ¶ added in v0.19.0
func (u LimitsConfigAndUsage) ToPartialLimitConfig() (result rcmgr.PartialLimitConfig)
type P2PHostOut ¶
func Host ¶
func Host(mctx helpers.MetricsCtx, lc fx.Lifecycle, params P2PHostIn) (out P2PHostOut, err error)
type PNetFingerprint ¶
type PNetFingerprint []byte
type ResourceInfo ¶ added in v0.19.0
type ResourceInfo struct { ScopeName string LimitName string LimitValue rcmgr.LimitVal64 CurrentUsage int64 }
type ResourceInfos ¶ added in v0.19.0
type ResourceInfos []ResourceInfo
func LimitConfigsToInfo ¶ added in v0.19.0
func LimitConfigsToInfo(stats LimitsConfigAndUsage) ResourceInfos
LimitConfigsToInfo gets limits and stats and generates a list of scopes and limits to be printed.
type ResourceLimitsAndUsage ¶ added in v0.19.0
type ResourceLimitsAndUsage struct { // This is duplicated from rcmgr.ResourceResourceLimits but adding *Usage fields. Memory rcmgr.LimitVal64 MemoryUsage int64 FD rcmgr.LimitVal FDUsage int Conns rcmgr.LimitVal ConnsUsage int ConnsInbound rcmgr.LimitVal ConnsInboundUsage int ConnsOutbound rcmgr.LimitVal ConnsOutboundUsage int Streams rcmgr.LimitVal StreamsUsage int StreamsInbound rcmgr.LimitVal StreamsInboundUsage int StreamsOutbound rcmgr.LimitVal StreamsOutboundUsage int }
func (ResourceLimitsAndUsage) ToResourceLimits ¶ added in v0.19.0
func (u ResourceLimitsAndUsage) ToResourceLimits() rcmgr.ResourceLimits
type RoutingOption ¶
type RoutingOption func(args RoutingOptionArgs) (routing.Routing, error)
func ConstructDefaultRouting ¶ added in v0.18.0
func ConstructDefaultRouting(cfg *config.Config, routingOpt RoutingOption) RoutingOption
ConstructDefaultRouting returns routers used when Routing.Type is unset or set to "auto"
func ConstructDelegatedOnlyRouting ¶ added in v0.37.0
func ConstructDelegatedOnlyRouting(cfg *config.Config) RoutingOption
ConstructDelegatedOnlyRouting returns routers used when Routing.Type is set to "delegated" This provides HTTP-only routing without DHT, using only delegated routers and IPNS publishers. Useful for environments where DHT connectivity is not available or desired