// Mount mounts an IpfsNode instance at a particular path. It // serves until the process receives exit signals (to Unmount). func Mount(ipfs *core.IpfsNode, fpath string, ipfspath string) (mount.Mount, error) { log.Infof("Mounting ipns at %s...", fpath) // setup the Mount abstraction. m := mount.New(ipfs.Context(), fpath) // go serve the mount m.Mount(func(m mount.Mount) error { return internalMount(ipfs, fpath, ipfspath) }, internalUnmount) select { case <-m.Closed(): return nil, fmt.Errorf("failed to mount") case <-time.After(time.Second): // assume it worked... } // bind the mount (ContextCloser) to the node, so that when the node exits // the fsclosers are automatically closed. ipfs.AddCloserChild(m) return m, nil }