import "berty.tech/berty/go/internal/ipfsutil"
Package ipfsutil contains helpers around IPFS (logging, datastore, networking, core API, ...).
api.go collector_bandwidth.go collector_host.go conn_logger.go datastore_namespaced.go doc.go extended_core_api.go helpers.go http_api.go keystore_datastore.go localrecord.go mdns_discovery.go metrics.go pubsub_adaptater.go pubsub_api.go pubsub_monitor.go repo.go testing.go util.go
const UnknownProtocol = "UnknownProtocol"
var DefaultSwarmListeners = []string{ "/ip4/0.0.0.0/tcp/0", "/ip6/::/tcp/0", "/ip4/0.0.0.0/udp/0/quic", "/ip6/::/udp/0/quic", }
func InjectPubSubAPI(api ipfs_interface.CoreAPI, ps ipfs_interface.PubSubAPI) ipfs_interface.CoreAPI
func MultiaddrIsEqual(a Multiaddrs, b Multiaddrs) bool
MultiaddrIsEqual return true if both slice are equal
func NewPubSubAPI(ctx context.Context, logger *zap.Logger, disc p2p_disc.Discovery, ps *p2p_pubsub.PubSub) ipfs_interface.PubSubAPI
OptionLocalRecord is given to CoreAPIOption.Options when the ipfs node setup
func OptionMDNSDiscovery(ctx context.Context, node *ipfs_core.IpfsNode, api ipfs_interface.CoreAPI) error
func ParseAndResolveRdvpMaddrs(ctx context.Context, log *zap.Logger, addrs []string) ([]*peer.AddrInfo, error)
ServeHTTPApi collects options, creates listener, prints status message and starts serving requests
func TestingRDVP(ctx context.Context, t testing.TB, h host.Host) (*rendezvous.RendezvousService, func())
type BandwidthCollector struct {
// contains filtered or unexported fields
}
func NewBandwidthCollector(reporter *metrics.BandwidthCounter) *BandwidthCollector
func (bc *BandwidthCollector) Collect(cmetric chan<- prometheus.Metric)
func (bc *BandwidthCollector) Describe(ch chan<- *prometheus.Desc)
type ConnMgr interface { TagPeer(peer.ID, string, int) UntagPeer(p peer.ID, tag string) Protect(id peer.ID, tag string) Unprotect(id peer.ID, tag string) (protected bool) GetTagInfo(p peer.ID) *connmgr.TagInfo }
type CoreAPIConfig struct { BootstrapAddrs []string SwarmAddrs []string APIAddrs []string Announce []string NoAnnounce []string APIConfig config.API DisableCorePubSub bool HostConfig func(host.Host, p2p_routing.Routing) error ExtraLibp2pOption p2p.Option DHTOption []p2p_dht.Option IpfsConfigPatch IpfsConfigPatcher Routing ipfs_libp2p.RoutingOption Host ipfs_libp2p.HostOption Options []CoreAPIOption }
type CoreAPIMock interface { API() ExtendedCoreAPI PubSub() *pubsub.PubSub Tinder() tinder.Driver MockNetwork() p2p_mocknet.Mocknet MockNode() *ipfs_core.IpfsNode Close() }
CoreAPIMock implements ipfs.CoreAPI and adds some debugging helpers
TestingCoreAPI returns a fully initialized mocked Core API. If you want to do some tests involving multiple peers you should use `TestingCoreAPIUsingMockNet` with the same mocknet instead.
func TestingCoreAPIUsingMockNet(ctx context.Context, t testing.TB, opts *TestingAPIOpts) (CoreAPIMock, func())
TestingCoreAPIUsingMockNet returns a fully initialized mocked Core API with the given mocknet
type DiscoveryNotifee struct {
// contains filtered or unexported fields
}
func (n *DiscoveryNotifee) HandlePeerFound(pi peer.AddrInfo)
const ( TypeEventMonitorPeerUnknown EventMonitor = iota TypeEventMonitorPeerJoined TypeEventMonitorPeerLeaved )
type EvtPubSubTopic struct { EventType EventMonitor Topic string PeerID peer.ID }
func InjectPubSubCoreAPIExtendedAdaptater(exapi ExtendedCoreAPI, ps ipfs_interface.PubSubAPI) ExtendedCoreAPI
func NewConfigurableCoreAPI(ctx context.Context, bcfg *ipfs_node.BuildCfg, opts ...CoreAPIOption) (ExtendedCoreAPI, *ipfs_core.IpfsNode, error)
NewConfigurableCoreAPI returns an IPFS CoreAPI from a provided ipfs_node.BuildCfg
func NewCoreAPI(ctx context.Context, cfg *CoreAPIConfig) (ExtendedCoreAPI, *ipfs_core.IpfsNode, error)
func NewCoreAPIFromDatastore(ctx context.Context, ds ds.Batching, cfg *CoreAPIConfig) (ExtendedCoreAPI, *ipfs_core.IpfsNode, error)
func NewCoreAPIFromRepo(ctx context.Context, repo ipfs_repo.Repo, cfg *CoreAPIConfig) (ExtendedCoreAPI, *ipfs_core.IpfsNode, error)
func NewExtendedCoreAPI(host ipfs_host.Host, api ipfs_interface.CoreAPI) ExtendedCoreAPI
type HostCollector struct {
// contains filtered or unexported fields
}
func NewHostCollector(h host.Host) *HostCollector
func (cc *HostCollector) Collect(cmetric chan<- prometheus.Metric)
func (cc *HostCollector) Describe(ch chan<- *prometheus.Desc)
func ChainIpfsConfigPatch(ps ...IpfsConfigPatcher) IpfsConfigPatcher
ChainIpfsConfigPatch will execute multiple IpfsConfigPatcher from the first to the last. They can be safely be nilled and will just be ignored.
type LocalRecord struct {
// contains filtered or unexported fields
}
called when a stream closed
called when a connection opened
called when a connection closed
called when network starts listening on an addr
called when network stops listening on an addr
called when a stream opened
func NewMultiaddrs(m []ma.Multiaddr) Multiaddrs
func (ms Multiaddrs) Len() int
Len is the number of elements in the collection.
func (ms Multiaddrs) Less(i, j int) bool
Less reports whether the element with index i should sort before the element with index j.
func (ms Multiaddrs) Swap(i, j int)
Swap swaps the elements with indexes i and j.
type PubSubAPI struct { *p2p_pubsub.PubSub // contains filtered or unexported fields }
Ls lists subscribed topics by name
func (ps *PubSubAPI) Peers(ctx context.Context, opts ...ipfs_iopts.PubSubPeersOption) ([]p2p_peer.ID, error)
Peers list peers we are currently pubsubbing with
Publish a message to a given pubsub topic
func (ps *PubSubAPI) Subscribe(ctx context.Context, topic string, opts ...ipfs_iopts.PubSubSubscribeOption) (ipfs_interface.PubSubSubscription, error)
Subscribe to messages on a given topic
type PubsubMonitor struct {
// contains filtered or unexported fields
}
func (pt *PubsubMonitor) Emit(e *EvtPubSubTopic)
func (pt *PubsubMonitor) EventTracerOption() ps.Option
func (pt *PubsubMonitor) Trace(e *ps_pb.TraceEvent)
type TestingAPIOpts struct { Logger *zap.Logger Mocknet p2p_mocknet.Mocknet RDVPeer p2p_peer.AddrInfo Datastore ds.Batching }
Package ipfsutil imports 70 packages (graph). Updated 2021-01-22. Refresh now. Tools for package owners.