package ipfs import ( "context" "github.com/libp2p/go-libp2p/core/crypto" "github.com/libp2p/go-libp2p/core/peer" "atfs.dev/internal/store" ) // StartOffline brings up a Node exactly like Start, but skips dialing the // real IPFS bootstrap peers, DHT bootstrapping, and the periodic provide // loop (see start's network parameter) — a real libp2p host and Bitswap // stack, servable and fetchable, with no live network traffic. internal/ipfs's // own tests reach start directly for this; StartOffline exists so other // packages' tests (internal/pin's, for one) can drive a genuine, loopback-only // Node end to end instead of a fake stand-in for the whole trustless // pipeline. Not for production use: a Node with no DHT participation can // never be found by anyone. func StartOffline(ctx context.Context, dataDir string, priv crypto.PrivKey, st *store.Store) (*Node, error) { return start(ctx, dataDir, priv, 0, st, false, WebSocketConfig{}) } // Connect dials other's current listen addresses directly from n's host — // the same stand-in for peer discovery internal/ipfs's own offline tests // use, since a StartOffline node bootstraps no DHT to find a peer through // otherwise. func (n *Node) Connect(ctx context.Context, other *Node) error { return n.host.Connect(ctx, peer.AddrInfo{ID: other.PeerID(), Addrs: other.Addrs()}) }