I am exploring the possibility of embedding go-ipfs in another application I have, where I programmatically create a node and programmatically perform tasks on that node…I looked briefly into the go-ipfs on github and it was not immediately clear if I can use it as a library instead of as a binary.
I also see no example on how to go about this. (Most or all examples are focused on running the go-ipfs binary instead)
// Create a config with default options and a 2048 bit key
cfg, err := config.Init(ioutil.Discard, 2048)
if err != nil {
return "", err
}
// Here, configuration is being updated
// https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#ipfs-filestore
cfg.Experimental.FilestoreEnabled = true
// https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#ipfs-urlstore
cfg.Experimental.UrlstoreEnabled = true
// https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#directory-sharding--hamt
cfg.Experimental.ShardingEnabled = true
// https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#ipfs-p2p
cfg.Experimental.Libp2pStreamMounting = true
// https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#p2p-http-proxy
cfg.Experimental.P2pHttpProxy = true
// https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#strategic-providing
cfg.Experimental.StrategicProviding = true
But the problem now is, I do not see how to enable pubsub, using this pattern? Nothing like cfg.Experimental.PubSub = true is available. That is the part I am stranded at.