mount_unix.go 616 Bytes
Newer Older
Vasily Kolobkov's avatar
Vasily Kolobkov committed
1
// +build linux darwin freebsd netbsd openbsd
Tonis Tiigi's avatar
Tonis Tiigi committed
2
// +build !nofuse
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
3

Jeromy's avatar
Jeromy committed
4 5 6
package ipns

import (
7 8
	core "github.com/ipfs/go-ipfs/core"
	mount "github.com/ipfs/go-ipfs/fuse/mount"
Jeromy's avatar
Jeromy committed
9 10
)

Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
11 12
// Mount mounts ipns at a given location, and returns a mount.Mount instance.
func Mount(ipfs *core.IpfsNode, ipnsmp, ipfsmp string) (mount.Mount, error) {
13 14 15 16 17
	cfg, err := ipfs.Repo.Config()
	if err != nil {
		return nil, err
	}

Ho-Sheng Hsiao's avatar
Ho-Sheng Hsiao committed
18 19
	allow_other := cfg.Mounts.FuseAllowOther

20
	fsys, err := NewFileSystem(ipfs, ipfs.PrivateKey, ipfsmp, ipnsmp)
21
	if err != nil {
Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
22
		return nil, err
23
	}
Jeromy's avatar
Jeromy committed
24

25
	return mount.NewMount(ipfs.Process(), fsys, ipnsmp, allow_other)
Jeromy's avatar
Jeromy committed
26
}