mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-10 10:47:51 +08:00
move default hash into ipfs2, committed on freemont troll
This commit is contained in:
parent
ab805f3382
commit
e857a5bc9f
@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
@ -9,7 +10,10 @@ import (
|
||||
|
||||
cmds "github.com/jbenet/go-ipfs/commands"
|
||||
config "github.com/jbenet/go-ipfs/config"
|
||||
core "github.com/jbenet/go-ipfs/core"
|
||||
ci "github.com/jbenet/go-ipfs/crypto"
|
||||
imp "github.com/jbenet/go-ipfs/importer"
|
||||
chunk "github.com/jbenet/go-ipfs/importer/chunk"
|
||||
peer "github.com/jbenet/go-ipfs/peer"
|
||||
u "github.com/jbenet/go-ipfs/util"
|
||||
)
|
||||
@ -114,6 +118,29 @@ func doInit(configRoot string, dspathOverride string, force bool, nBitsForKeypai
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
nd, err := core.NewIpfsNode(&conf, false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer nd.Close()
|
||||
|
||||
// Set up default file
|
||||
msg := `Hello and Welcome to IPFS!
|
||||
If you're seeing this, that means that you have successfully
|
||||
installed ipfs and are now interfacing with the wonderful
|
||||
world of DAGs and hashes!
|
||||
`
|
||||
reader := bytes.NewBufferString(msg)
|
||||
|
||||
defnd, err := imp.BuildDagFromReader(reader, nd.DAG, nd.Pinning.GetManual(), chunk.DefaultSplitter)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
k, _ := defnd.Key()
|
||||
fmt.Printf("Default file key: %s\n", k)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user