Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
e857a5bc
Commit
e857a5bc
authored
Nov 15, 2014
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move default hash into ipfs2, committed on freemont troll
parent
ab805f33
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
cmd/ipfs2/init.go
cmd/ipfs2/init.go
+27
-0
No files found.
cmd/ipfs2/init.go
View file @
e857a5bc
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
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment