Switch go-ipfs between online/offline mode?

Hey there!

Creating an very basic IPFS node from Go is fairly straightforward:

core.NewNode(context.TODO(), &core.BuildCfg{Online: true})

However, I couldn’t figure out based on the APIs whether it’s possible to switch between offline and online mode of operation?

There is a method SetLocal on a core.IpfsNode object, but it does something completely weird, where calling it with false does not set it to online mode. Not sure what this method was supposed to do really.

// SetLocal will set the IpfsNode to local mode
func (n *IpfsNode) SetLocal(isLocal bool) {
	if isLocal {
		n.mode = localMode
	n.localModeSet = true

Is it possible to start up an IPFS node in offline mode, and periodically switch between offline/online (i.e. sync stuff when needed, don’t waste bandwidth when not needed)? In theory I could recreate the node every time I want to switch modes of operation, but that really seems like overkill.