core

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 51 Imported by: 68

Documentation

Overview

Package core implements the IpfsNode object and related methods.

Packages underneath core/ provide a (relatively) stable, low-level API to carry out most IPFS-related tasks. For more details on the other interfaces and how core/... fits into the bigger IPFS picture, see:

$ godoc github.com/ipfs/go-ipfs

Index

Constants

This section is empty.

Variables

View Source
var TempBootstrapPeersKey = datastore.NewKey("/local/temp_bootstrap_peers")

Functions

func RegisterFXOptionFunc added in v0.15.0

func RegisterFXOptionFunc(optFunc fxOptFunc)

RegisterFXOptionFunc registers a function that is run before the fx app is initialized. Functions are invoked in the order they are registered, and the resulting options are passed into the next function's FXNodeInfo.

Note that these are applied globally, by all invocations of NewNode. There are multiple places in Kubo that construct nodes, such as:

  • Repo initialization
  • Daemon initialization
  • When running migrations
  • etc.

If your fx options are doing anything sophisticated, you should keep this in mind.

For example, if you plug in a blockservice that disallows non-allowlisted CIDs, this may break migrations that fetch migration code over IPFS.

Types

type BuildCfg added in v0.3.8

type BuildCfg = node.BuildCfg // Alias for compatibility until we properly refactor the constructor interface

type ConstructPeerHostOpts added in v0.4.8

type ConstructPeerHostOpts struct {
	AddrsFactory      p2pbhost.AddrsFactory
	DisableNatPortMap bool
	DisableRelay      bool
	EnableRelayHop    bool
	ConnectionManager connmgr.ConnManager
}

type FXNodeInfo added in v0.15.0

type FXNodeInfo struct {
	FXOptions []fx.Option
}

FXNodeInfo contains information useful for adding fx options. This is the extension point for providing more info/context to fx plugins to make decisions about what options to include.

type IpfsNode

type IpfsNode struct {

	// Self
	Identity peer.ID // the local node's identity

	Repo repo.Repo

	// Local node
	Pinning         pin.Pinner             // the pinning manager
	Mounts          Mounts                 `optional:"true"` // current mount state, if any.
	PrivateKey      ic.PrivKey             `optional:"true"` // the local node's private Key
	PNetFingerprint libp2p.PNetFingerprint `optional:"true"` // fingerprint of private network

	// Services
	Peerstore            pstore.Peerstore          `optional:"true"` // storage for other Peer instances
	Blockstore           bstore.GCBlockstore       // the block store (lower level)
	Filestore            *filestore.Filestore      `optional:"true"` // the filestore blockstore
	BaseBlocks           node.BaseBlocks           // the raw blockstore, no filestore wrapping
	GCLocker             bstore.GCLocker           // the locker used to protect the blockstore during gc
	Blocks               bserv.BlockService        // the block service, get/add blocks.
	DAG                  ipld.DAGService           // the merkle dag service, get/add objects.
	IPLDFetcherFactory   fetcher.Factory           `name:"ipldFetcher"`   // fetcher that paths over the IPLD data model
	UnixFSFetcherFactory fetcher.Factory           `name:"unixfsFetcher"` // fetcher that interprets UnixFS data
	Reporter             *metrics.BandwidthCounter `optional:"true"`
	Discovery            mdns.Service              `optional:"true"`
	FilesRoot            *mfs.Root
	RecordValidator      record.Validator

	// Online
	PeerHost           p2phost.Host               `optional:"true"` // the network host (server+client)
	Peering            *peering.PeeringService    `optional:"true"`
	Filters            *ma.Filters                `optional:"true"`
	Bootstrapper       io.Closer                  `optional:"true"` // the periodic bootstrapper
	Routing            irouting.ProvideManyRouter `optional:"true"` // the routing system. recommend ipfs-dht
	DNSResolver        *madns.Resolver            // the DNS resolver
	IPLDPathResolver   pathresolver.Resolver      `name:"ipldPathResolver"`   // The IPLD path resolver
	UnixFSPathResolver pathresolver.Resolver      `name:"unixFSPathResolver"` // The UnixFS path resolver
	Exchange           exchange.Interface         // the block exchange + strategy (bitswap)
	Namesys            namesys.NameSystem         // the name system, resolves paths to hashes
	Provider           provider.System            // the value provider system
	IpnsRepub          *ipnsrp.Republisher        `optional:"true"`
	GraphExchange      graphsync.GraphExchange    `optional:"true"`
	ResourceManager    network.ResourceManager    `optional:"true"`

	PubSub   *pubsub.PubSub             `optional:"true"`
	PSRouter *psrouter.PubsubValueStore `optional:"true"`

	DHT       *ddht.DHT       `optional:"true"`
	DHTClient routing.Routing `name:"dhtc" optional:"true"`

	P2P *p2p.P2P `optional:"true"`

	Process goprocess.Process

	// Flags
	IsOnline bool `optional:"true"` // Online is set when networking is enabled.
	IsDaemon bool `optional:"true"` // Daemon is set when running on a long-running daemon.
	// contains filtered or unexported fields
}

IpfsNode is IPFS Core module. It represents an IPFS instance.

func NewNode added in v0.3.8

func NewNode(ctx context.Context, cfg *BuildCfg) (*IpfsNode, error)

NewNode constructs and returns an IpfsNode using the given cfg.

func (*IpfsNode) Bootstrap

func (n *IpfsNode) Bootstrap(cfg bootstrap.BootstrapConfig) error

Bootstrap will set and call the IpfsNodes bootstrap function.

func (*IpfsNode) Close added in v0.3.6

func (n *IpfsNode) Close() error

Close calls Close() on the App object

func (*IpfsNode) Context added in v0.3.6

func (n *IpfsNode) Context() context.Context

Context returns the IpfsNode context

type Mounts

type Mounts struct {
	Ipfs mount.Mount
	Ipns mount.Mount
}

Mounts defines what the node's mount state is. This should perhaps be moved to the daemon or mount. It's here because it needs to be accessible across daemon requests.

Directories

Path Synopsis
Package commands implements the ipfs command interface
Package commands implements the ipfs command interface
dag
e
pin
Package coreapi provides direct access to the core commands in IPFS.
Package coreapi provides direct access to the core commands in IPFS.
Package corehttp provides utilities for the webui, gateways, and other high-level HTTP interfaces to IPFS.
Package corehttp provides utilities for the webui, gateways, and other high-level HTTP interfaces to IPFS.

Jump to

Keyboard shortcuts

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