// updateApply applies an update of the ipfs binary and shuts down the node if successful func updateApply(n *core.IpfsNode) (*UpdateOutput, error) { // TODO: 'force bool' param that stops the daemon (if running) before update output := &UpdateOutput{ OldVersion: updates.Version, } u, err := updates.CheckForUpdate() if err != nil { return nil, err } if u == nil { output.NewVersion = updates.Version return output, nil } output.NewVersion = u.Version if n.OnlineMode() { return nil, errors.New(`You must stop the IPFS daemon before updating.`) } if err = updates.Apply(u); err != nil { return nil, err } return output, nil }
// printSwarmAddrs prints the addresses of the host func printSwarmAddrs(node *core.IpfsNode) { if !node.OnlineMode() { fmt.Println("Swarm not listening, running in offline mode.") return } var addrs []string for _, addr := range node.PeerHost.Addrs() { addrs = append(addrs, addr.String()) } sort.Sort(sort.StringSlice(addrs)) for _, addr := range addrs { fmt.Printf("Swarm listening on %s\n", addr) } }