diff --git a/assets/README.md b/assets/README.md index b22d645dc..caffb3abb 100644 --- a/assets/README.md +++ b/assets/README.md @@ -4,10 +4,10 @@ Do not edit the .go files directly. -Instead, edit the source files and use `go2doc` from within the +Instead, edit the source files and use `go generate` from within the assets directory: ``` -go get github.com/whyrusleeping/doc2go +go get -u github.com/jteeuwen/go-bindata/... go generate ``` diff --git a/assets/about.go b/assets/about.go deleted file mode 100644 index 2a0bd6005..000000000 --- a/assets/about.go +++ /dev/null @@ -1,56 +0,0 @@ -package assets - -var Init_doc_about = ` - IPFS -- Inter-Planetary File system - -IPFS is a global, versioned, peer-to-peer filesystem. It combines good ideas -from Git, BitTorrent, Kademlia, SFS, and the Web. It is like a single bit- -torrent swarm, exchanging git objects. IPFS provides an interface as simple -as the HTTP web, but with permanence built in. You can also mount the world -at /ipfs. - -IPFS is a protocol: -- defines a content-addressed file system -- coordinates content delivery -- combines Kademlia + BitTorrent + Git - -IPFS is a filesystem: -- has directories and files -- mountable filesystem (via FUSE) - -IPFS is a web: -- can be used to view documents like the web -- files accessible via HTTP at 'http://ipfs.io/' -- browsers or extensions can learn to use 'ipfs://' directly -- hash-addressed content guarantees authenticity - -IPFS is modular: -- connection layer over any network protocol -- routing layer -- uses a routing layer DHT (kademlia/coral) -- uses a path-based naming service -- uses bittorrent-inspired block exchange - -IPFS uses crypto: -- cryptographic-hash content addressing -- block-level deduplication -- file integrity + versioning -- filesystem-level encryption + signing support - -IPFS is p2p: -- worldwide peer-to-peer file transfers -- completely decentralized architecture -- **no** central point of failure - -IPFS is a cdn: -- add a file to the filesystem locally, and it's now available to the world -- caching-friendly (content-hash naming) -- bittorrent-based bandwidth distribution - -IPFS has a name service: -- IPNS, an SFS inspired name system -- global namespace based on PKI -- serves to build trust chains -- compatible with other NSes -- can map DNS, .onion, .bit, etc to IPNS -` diff --git a/assets/assets.go b/assets/assets.go index 61ee1dc04..909b5ab77 100644 --- a/assets/assets.go +++ b/assets/assets.go @@ -1,16 +1,62 @@ -//go:generate doc2go -in=init-doc/about -out=about.go -package=assets -//go:generate doc2go -in=init-doc/readme -out=readme.go -package=assets -//go:generate doc2go -in=init-doc/help -out=help.go -package=assets -//go:generate doc2go -in=init-doc/contact -out=contact.go -package=assets -//go:generate doc2go -in=init-doc/security-notes -out=security-notes.go -package=assets -//go:generate doc2go -in=init-doc/quick-start -out=quick-start.go -package=assets +//go:generate go-bindata -pkg=assets init-doc + package assets -var Init_dir = map[string]string{ - "about": Init_doc_about, - "readme": Init_doc_readme, - "help": Init_doc_help, - "contact": Init_doc_contact, - "security-notes": Init_doc_security_notes, - "quick-start": Init_doc_quick_start, +import ( + "bytes" + "fmt" + "path/filepath" + + "github.com/ipfs/go-ipfs/blocks/key" + "github.com/ipfs/go-ipfs/core" + "github.com/ipfs/go-ipfs/core/coreunix" + uio "github.com/ipfs/go-ipfs/unixfs/io" +) + +// initDocPaths lists the paths for the docs we want to seed during --init +var initDocPaths = []string{ + "init-doc/about", + "init-doc/readme", + "init-doc/help", + "init-doc/contact", + "init-doc/security-notes", + "init-doc/quick-start", +} + +func SeedInitDocs(nd *core.IpfsNode) (*key.Key, error) { + dirb := uio.NewDirectory(nd.DAG) + + for _, p := range initDocPaths { + d, err := Asset(p) + if err != nil { + return nil, fmt.Errorf("assets.AddDocuDir: could load Asset '%s': %s", p, err) + } + + s, err := coreunix.Add(nd, bytes.NewBuffer(d)) + if err != nil { + return nil, fmt.Errorf("assets.AddDocuDir: could not Add '%s': %s", p, err) + } + + fname := filepath.Base(p) + k := key.B58KeyDecode(s) + if err := dirb.AddChild(fname, k); err != nil { + return nil, fmt.Errorf("assets.AddDocuDir: could not add '%s' as a child: %s", fname, err) + } + } + + dir := dirb.GetNode() + dkey, err := nd.DAG.Add(dir) + if err != nil { + return nil, fmt.Errorf("assets.AddDocuDir: DAG.Add(dir) failed: %s", err) + } + + if err := nd.Pinning.Pin(nd.Context(), dir, true); err != nil { + return nil, fmt.Errorf("assets.AddDocuDir: Pinning on init-docu failed: %s", err) + } + + if err := nd.Pinning.Flush(); err != nil { + return nil, fmt.Errorf("assets.AddDocuDir: Pinnig flush failed: %s", err) + } + + return &dkey, nil } diff --git a/assets/assets_test.go b/assets/assets_test.go new file mode 100644 index 000000000..0d5b6b444 --- /dev/null +++ b/assets/assets_test.go @@ -0,0 +1,46 @@ +package assets + +import ( + "bytes" + "io/ioutil" + "sync" + "testing" +) + +// TestEmbeddedDocs makes sure we don't forget to regenerate after documentation change +func TestEmbeddedDocs(t *testing.T) { + const wantCnt = 6 + if len(initDocPaths) < wantCnt { + t.Fatalf("expected %d documents got %d", wantCnt, len(initDocPaths)) + } + + var wg sync.WaitGroup + for _, f := range initDocPaths { + wg.Add(1) + // compare asset + go func(f string) { + defer wg.Done() + // load data from filesystem (git) + vcsData, err := ioutil.ReadFile(f) + if err != nil { + t.Errorf("asset %s: could not read vcs file: %s", f, err) + return + } + + // load data from emdedded source + embdData, err := Asset(f) + if err != nil { + t.Errorf("asset %s: could not read vcs file: %s", f, err) + return + } + + if !bytes.Equal(vcsData, embdData) { + t.Errorf("asset %s: vcs and embedded data isnt equal", f) + return + } + + t.Logf("checked %s", f) + }(f) + } + wg.Wait() +} diff --git a/assets/bindata.go b/assets/bindata.go new file mode 100644 index 000000000..bd5ef553c --- /dev/null +++ b/assets/bindata.go @@ -0,0 +1,348 @@ +package assets + +import ( + "bytes" + "compress/gzip" + "fmt" + "io" + "strings" + "os" + "time" + "io/ioutil" + "path" + "path/filepath" +) + +func bindata_read(data []byte, name string) ([]byte, error) { + gz, err := gzip.NewReader(bytes.NewBuffer(data)) + if err != nil { + return nil, fmt.Errorf("Read %q: %v", name, err) + } + + var buf bytes.Buffer + _, err = io.Copy(&buf, gz) + clErr := gz.Close() + + if err != nil { + return nil, fmt.Errorf("Read %q: %v", name, err) + } + if clErr != nil { + return nil, err + } + + return buf.Bytes(), nil +} + +type asset struct { + bytes []byte + info os.FileInfo +} + +type bindata_file_info struct { + name string + size int64 + mode os.FileMode + modTime time.Time +} + +func (fi bindata_file_info) Name() string { + return fi.name +} +func (fi bindata_file_info) Size() int64 { + return fi.size +} +func (fi bindata_file_info) Mode() os.FileMode { + return fi.mode +} +func (fi bindata_file_info) ModTime() time.Time { + return fi.modTime +} +func (fi bindata_file_info) IsDir() bool { + return false +} +func (fi bindata_file_info) Sys() interface{} { + return nil +} + +var _init_doc_about = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x64\x54\x4d\x8f\xdb\x36\x10\xbd\xfb\x57\xcc\xad\x9b\x8d\xe5\x05\x7a\x0c\x8a\x1e\x8a\x74\x1b\x23\x40\x60\xc0\x5b\x14\xbd\xed\x88\xa4\x25\x76\x29\x8e\x40\x52\x76\xd5\x5f\xdf\x37\x94\xbc\x76\x10\x5f\x2c\x5b\xf3\xf1\xde\x9b\x79\xb3\xa1\x1f\x3e\xfb\xc3\xf3\x91\x9a\x86\xf6\xb1\xb8\xd4\x1c\x02\x47\x57\x38\xcd\xf4\xec\x83\xa3\x3c\xe7\xe2\x86\xcd\xa6\x06\xf9\x4c\x4c\x5d\x90\x96\xc3\x96\xce\x2e\x65\x2f\xd1\xd9\x2d\x8d\x0e\x89\x45\x1a\xfd\xa6\x13\xd2\x96\xac\x1d\xed\x0b\x19\x19\x5a\x1f\x5d\xa6\x4e\xc4\x92\xb7\x8e\xf3\xe6\x94\x64\xa0\x3f\x7c\xd9\xd2\x6f\xbe\xbc\x48\x4a\x2e\xe2\xf9\x2b\x5b\x37\x04\xcf\x5b\x3a\x3e\x1f\xb7\xc4\xd1\x52\xe9\x1d\xfd\xe5\xda\x5a\x08\xcd\x83\x7f\x73\x40\x90\x7d\xec\x00\xad\xf5\xa5\xd9\x94\x25\x9b\xf2\x85\xd3\xb0\x25\xf7\xaf\xe9\x39\x76\x08\xa0\xce\x17\x92\xf6\x1f\x67\x4a\xde\x2d\x1c\xc7\x24\x67\x00\x00\x89\x48\x5e\xc9\x9e\xd8\xa0\x5e\x46\xc1\x61\x0c\x6e\x83\x27\x6d\xf8\xe5\xe5\xe5\x40\x17\xd7\x6e\xa9\x9d\x0a\x5d\x7c\xe9\x41\x30\x0d\x90\x25\x22\xbc\x9d\x7c\x00\x98\xb8\xa3\xbf\x65\x22\x83\x52\x1c\xb2\xd0\x20\x13\x50\x68\xfa\x45\x52\xb0\x1b\x2e\xf4\xe4\xc7\x53\xde\xdd\x4b\x07\x00\x45\x8c\x84\x4f\x9b\x86\xac\x3b\x55\x59\x18\x0a\x01\x4b\x2c\x0d\x5b\x9b\x5c\xce\xce\x56\x09\xaf\xca\x37\x78\x2f\xc9\xfa\xc8\x05\xd1\x6b\x2c\xb2\x83\xc7\x00\xe6\xfa\x7a\x15\xf8\xaa\x1f\x7d\xbc\x93\x15\x3f\x20\xf4\x3d\x88\xdb\x7c\x14\x46\x0f\xd2\xd6\x27\xa8\x24\xc9\x57\x69\x96\xf6\x19\xef\x2a\x27\x6e\x81\xe5\x96\x43\x0f\x67\x74\x78\xfe\xf3\xf8\xfb\x87\xfb\xa2\x90\x4b\xab\xa9\x1c\xad\xa3\x49\x49\x14\xa1\xb3\x77\x17\xb2\x62\xa6\x01\x48\xd6\xf1\x55\x89\x5c\x8b\xe0\x5a\x94\xd8\x18\x90\xf6\xda\x45\x2b\x57\xf1\x21\xde\x6b\x5f\xca\xf8\xe9\x69\xd1\xd0\xcb\xd3\x2f\x23\x97\xfe\xd7\x57\xa4\xb5\x49\x2e\x19\xbb\x47\x92\x30\x6e\xa8\xa1\x5b\x98\x6b\xeb\xe0\x38\x45\x6d\x0c\x00\xf4\xaa\xa9\xa8\xf0\xba\xf2\x0b\xf3\x42\xb7\xbf\x13\xfa\x2a\x67\x37\x71\x62\x3c\x2a\x9e\x09\x08\x63\xf1\xc6\x97\xf9\xc6\x70\x10\x3b\x05\x4e\x95\xa3\xc4\x88\x72\x68\x4a\x81\x67\x2c\xbc\x60\x10\xd0\x6d\x26\xf8\x06\xc3\x7f\x7b\x1f\x33\x82\x93\x4c\x45\x97\xb1\x46\xe2\x37\x80\xa9\x5c\xdf\xfd\x4d\x9f\xbf\xbc\xd0\xc3\xdb\x3a\xbd\x27\x23\x89\xc3\x87\x5b\xac\x12\x6f\x5a\x56\xb8\x91\x07\xcd\x02\xfb\xb3\x37\xee\x1a\x02\x1f\xac\x2e\x68\x7c\xcc\x23\xc8\x5a\x6a\x83\x98\xb7\xab\x1b\xdc\xca\xa3\x46\x9b\x34\x8f\x45\x2a\x91\xfa\xd4\x25\x1e\x7b\x6f\x1a\x55\xe6\x5d\x8f\x55\x21\x34\x53\xc1\xb5\x56\x13\xdc\xd9\x05\xec\x9d\x9d\xc6\xe0\x0d\x2b\xff\x75\x86\xd5\x4b\x5d\x82\x5e\x58\xb6\xf5\x2a\x2c\x99\xb7\xb5\x59\xd3\xe1\x20\x6d\xaa\xda\x7d\x84\xeb\xba\x58\xe9\x4c\xe3\x28\xe9\x6e\x47\xc7\x9f\x47\xc5\x57\x8d\x74\x81\x61\x7f\xbc\x2f\x54\x30\xae\x7c\x42\xaf\xc5\x00\x70\x6f\x71\x61\x06\x3c\x03\xf8\xd0\xcf\xff\x07\x11\x38\x99\xde\x17\xcc\x6a\x4a\x2a\xd6\xe3\x63\x94\xc7\x47\x5a\x23\x68\x14\xe0\x26\x39\xd1\x89\x7d\xd0\x88\xbb\x75\x36\x36\x2a\x02\xc8\xb0\x1a\x46\x97\x4a\x37\xf7\xce\x08\x50\x85\x43\x98\x97\x43\xe5\xcb\x4f\x99\xa2\x5c\x88\xcf\xa8\x56\x3d\xb3\x66\x2c\xe7\x40\xad\x01\x30\xb1\x6b\x4e\xb0\x59\xb4\xc0\xfa\x70\xf5\x7d\x55\x7e\x19\xad\x8e\xfd\x6e\x9c\xcb\xd4\x5b\x34\x80\x0c\x38\x43\xd6\xe7\x92\x3c\xae\x92\x8a\xbf\xc0\x55\xff\xb2\x66\xbb\xeb\x5a\x28\xf0\xfd\xe1\x5b\xbd\xa0\x7a\x49\xe9\x7d\x29\x96\xa8\xeb\x59\x59\xee\x78\xfd\x33\x8f\x7a\x08\x97\x6e\x18\xcd\xe1\xeb\x1e\xef\xb5\x1c\xf6\x05\x34\xf4\xe4\xc1\xcf\x69\xca\x38\xe7\x3d\xa3\xde\xaa\x3a\xb6\x40\x99\xd6\x13\x29\x20\x9b\xe8\xdb\xb1\x5e\x0e\x35\xe3\xc0\x23\x7d\x56\x18\x3b\xac\x83\x44\x7c\xb7\x7a\xf1\x5d\x31\x5a\x53\x11\x6e\xfe\x0f\x00\x00\xff\xff\x27\xf1\x1f\xbc\x8d\x06\x00\x00") + +func init_doc_about_bytes() ([]byte, error) { + return bindata_read( + _init_doc_about, + "init-doc/about", + ) +} + +func init_doc_about() (*asset, error) { + bytes, err := init_doc_about_bytes() + if err != nil { + return nil, err + } + + info := bindata_file_info{name: "init-doc/about", size: 1677, mode: os.FileMode(420), modTime: time.Unix(1427804268, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _init_doc_contact = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x1c\xcd\x41\x6a\x05\x21\x0c\xc6\xf1\xbd\xa7\xf8\xa0\xeb\xa7\x7b\x57\xa5\x43\xa1\xdd\xf6\x06\xd6\x97\xd1\xc0\x68\xa6\x1a\x07\xe6\xf6\xd5\xb7\xfa\x43\xf2\x23\xd9\xa4\x10\x72\xa8\x09\x32\x14\x5c\x67\x1a\xbe\x7f\x36\xc4\x1c\x14\x4d\xa4\x80\x77\xdc\x32\x26\xba\x08\xa1\xde\xf8\x1b\xd4\x95\xa5\x76\x6b\xcc\x26\x55\x43\x54\x68\x26\xf0\xb9\x77\x3c\xe9\x82\x52\x28\xde\x3c\xf0\x31\x52\xf7\xc8\xaa\x67\xf7\xce\x25\xd6\x3c\x7e\x6d\x94\xe2\x96\x74\x49\x1e\xaf\x72\xef\xf3\xe0\xe4\x5f\x74\x9c\x1e\xdc\xa2\xdd\x1b\x51\x95\x27\x59\x69\xc9\xbd\x2d\x35\xd7\x9f\x25\xf0\xe1\xd7\x83\xf7\x35\xb1\x2c\xe6\x3f\x00\x00\xff\xff\x7d\x69\x95\xc6\xbd\x00\x00\x00") + +func init_doc_contact_bytes() ([]byte, error) { + return bindata_read( + _init_doc_contact, + "init-doc/contact", + ) +} + +func init_doc_contact() (*asset, error) { + bytes, err := init_doc_contact_bytes() + if err != nil { + return nil, err + } + + info := bindata_file_info{name: "init-doc/contact", size: 189, mode: os.FileMode(420), modTime: time.Unix(1427876009, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _init_doc_help = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x3c\x8f\xc1\x71\xc4\x20\x0c\x45\xef\x5b\x85\x66\x72\xc6\xbe\xbb\x8d\x54\xc0\x82\x30\x9a\x60\xe4\x48\x62\x77\xe8\x3e\xe0\xc4\x39\xf2\xf5\xde\x47\xfa\xe4\x03\x21\x63\x39\x53\x2b\x20\xa8\xdc\x24\xa0\x42\x62\x81\x44\x35\x52\xdd\xa1\x8f\x0c\xde\xbe\x83\x17\x6e\x35\x02\x9d\x49\xb7\xc7\xc3\xc1\x77\xa3\xf0\xe5\xd4\xbc\xd8\x06\xfe\xf7\x09\x9a\xf9\x0d\x9c\xe0\xe5\x85\xb8\xe9\x45\x43\x42\x6f\x6d\xb4\x2f\xc3\xba\x82\xc0\xc7\xe1\x6b\xd4\xe9\x15\x52\x9b\x86\x2f\xe5\x3f\xbf\x39\xe7\xe6\x6e\x1b\xe0\x0b\xa5\xdf\x53\x88\xa8\x41\xe8\x39\xf6\x24\x53\x2c\x69\xd0\xd9\xec\xd4\x6d\x5d\x77\xb2\xdc\x9e\xcb\x20\xd7\x59\xb0\xee\xec\xfe\x8a\xc0\x32\x82\x4a\x18\x57\x9e\xac\x64\x2c\x7d\x78\x1f\xd7\x94\x2b\x90\x84\x25\x09\x62\xe5\x88\x0b\xcb\x7e\x1b\xf3\xcf\x56\xc9\xfa\x24\x20\x64\x5f\x2b\x96\xc7\x4f\x00\x00\x00\xff\xff\x2c\xe0\x8e\xed\x37\x01\x00\x00") + +func init_doc_help_bytes() ([]byte, error) { + return bindata_read( + _init_doc_help, + "init-doc/help", + ) +} + +func init_doc_help() (*asset, error) { + bytes, err := init_doc_help_bytes() + if err != nil { + return nil, err + } + + info := bindata_file_info{name: "init-doc/help", size: 311, mode: os.FileMode(420), modTime: time.Unix(1427876009, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _init_doc_quick_start = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x8c\x54\xdf\x73\xda\x38\x10\x7e\xf7\x5f\xb1\x97\x3e\x5c\x3a\x77\x8e\x49\x29\x29\x61\x3a\x9d\x49\x49\x03\x47\x13\x2e\x94\x34\x4d\xf2\x26\xec\x95\x2d\x90\x25\x55\x92\x71\xcd\x5f\x7f\x6b\x43\x80\x99\xcb\x8f\xce\xf8\xc1\xfb\xe3\xdb\xef\x5b\x49\xbb\x6f\xa0\x75\x74\x0c\x21\x4c\x0a\x11\x2f\x60\xea\x99\xf5\x41\x70\x93\x09\x07\xf4\x31\x70\xe8\x41\x73\x70\x99\xb6\x1e\xf0\x17\xcb\x8d\x44\x07\xa5\xf0\x19\xe4\x42\x89\x9c\x49\xf2\x1a\xc9\x14\xf3\x42\xab\x23\xf8\xc7\xd7\xb8\x1c\x99\xf2\xc0\x5c\xc0\xe0\xe0\x67\x53\xd8\xd5\x85\x0f\x8e\x60\xaa\xb5\xfa\x1b\x4a\xfc\x53\x4a\x28\xad\xf0\x48\x1c\x52\xab\x14\x2d\x78\x5d\x58\xe8\x85\x6f\x83\x20\x38\x4b\x12\xf2\x73\x21\x91\xbc\x20\x0c\x77\xbd\x20\x00\xc0\x38\xd3\x70\x90\xa1\x94\x1a\x4a\x6d\x65\x72\x00\x9f\x1a\x8b\x62\x75\x12\x30\xc2\xad\x1d\x41\x70\x2b\xb0\x04\xe1\x1b\x60\x13\x8c\x99\x87\x8f\x3e\xc3\x30\x63\x2e\x0b\x2b\x5d\x84\xa9\xf6\x61\x86\x16\x3f\x51\xfa\x8d\xad\x88\x32\x11\x16\x63\xaf\x6d\xd5\xc0\xf2\x05\xd9\xc0\xb5\xde\xff\x8f\x66\xcc\x6e\xb5\xcc\xd8\x8a\x34\x6c\xdc\xab\xa7\xdd\x76\x13\xda\x2a\x0c\xd7\x35\x37\x12\x7d\x26\x54\xea\x76\x32\xa5\xdb\x53\xb9\x56\xf7\x6c\x64\xa3\xe5\x89\xf6\x1e\xc3\xab\x97\xc3\xf6\x37\x52\x5e\xa4\x5f\x51\x1b\xdf\x90\x93\xa5\x62\xdc\xeb\xc2\x22\x7f\xb6\x8f\x26\x46\x87\xf0\x62\x98\x7c\xd2\x50\xf1\x01\xee\x5d\x61\x8a\xff\x53\x58\x1f\xe5\x3b\x8a\x27\x82\xf3\xfa\x7f\x6d\x07\xc1\xbf\xb3\x39\xdd\xe4\x9e\x22\xdd\x38\x9e\x2a\xf1\x7a\x46\xb4\x21\xd9\x4f\xdb\x2a\xbc\x16\x0a\xfe\x82\x41\x7f\x47\x65\xc8\xf3\x7c\x7f\x69\xfc\xfa\x55\x17\xea\xd5\x1a\x41\x70\xce\x30\xd7\x6a\x47\x9b\x34\x36\xc0\x21\x41\x99\xd2\x84\xa4\xa1\x42\x4b\x73\xca\xe4\xdb\xc7\x24\x91\x10\x72\x8c\x9e\xe6\x67\xd1\x40\x0f\xf3\xc2\x79\x98\x21\x68\x25\x85\xc2\x6d\xa2\x2b\x99\xcd\xc1\x20\x5a\xb7\x87\xdd\x7f\x2a\x8d\x2c\xcd\x43\x4b\xb4\x1e\xc3\xf5\xb9\xd4\xb3\x74\xa5\x0b\xb5\xbe\xb5\x43\x2a\xa2\xe8\x7d\xf7\x80\x17\x0e\xeb\xd5\xc0\x69\x6b\xc4\x8b\xea\x8f\x2d\x4f\x5e\x27\x93\x11\x27\x10\xd5\x8e\xe8\x63\x3d\x8d\x5a\xcb\x5d\x63\x4b\xd2\x40\xdb\x65\x7b\x38\x26\x61\x1e\xb7\x52\x74\x9e\x33\x95\xb8\x9d\xad\xb8\x48\x1f\xaf\x07\x40\x1b\x54\x90\x79\x6f\x7a\x51\x24\x75\xcc\x64\xa6\x9d\xef\x75\x5a\xad\xe3\xa8\xc4\x59\x21\x88\xed\xb3\xd5\xa5\xc3\x86\xaf\x71\x35\x7f\xf0\x32\x08\x60\x29\x12\xd4\xcf\xa5\x76\x5b\xdd\xd6\xba\x9d\x49\x7e\x1b\x9f\xac\x8a\x33\x85\x5f\x47\x2b\x11\xab\x91\xe1\xf6\x67\x7f\x78\x9a\x4e\xab\x93\xd9\xaa\xf3\x7e\x94\xc5\x95\xe1\xa3\xfb\x6c\xf0\xfd\x62\x52\x44\xb4\x4b\xab\x37\x8f\xc8\x9b\xaf\x0f\xe9\xb7\x71\x79\x3e\x7e\x28\x87\x7e\x34\x9d\xf7\xcd\x89\xed\x5c\xdc\x23\x5f\x99\xef\x97\xbc\x6a\x7f\x18\x2d\xaf\xfc\xe9\x79\xb9\xbc\x73\xd8\x9c\x56\xce\xd2\xcd\x14\xbe\xa2\xe9\xc1\xc4\xed\xe1\x92\xcf\xbf\xdc\x2d\x2f\x7f\x0c\x26\xd7\x3f\x66\xc3\x45\xfb\x6c\x7e\xde\x99\x77\xc7\x5f\xc6\xef\xd3\xfc\x62\xdc\x1d\xe5\x36\xe9\xa4\xdd\x76\x14\xbb\x66\x1b\x32\xbb\x48\x74\xa9\x68\x40\x55\x42\x8f\xd1\x02\x33\xe6\x77\xb8\xee\x3e\x5c\x9d\xf6\xc5\xfd\xdd\xfc\x16\x2f\xd4\x82\xdf\x0e\x78\xbb\xea\x88\x5f\x37\x0f\xef\xce\xfa\x38\x1d\x54\x97\xc7\xcb\xcf\xa3\xfb\xe3\xe1\x72\x72\x6d\xa2\xbc\xa6\x08\xfe\x0b\x00\x00\xff\xff\x5f\x73\x8d\x8f\x96\x06\x00\x00") + +func init_doc_quick_start_bytes() ([]byte, error) { + return bindata_read( + _init_doc_quick_start, + "init-doc/quick-start", + ) +} + +func init_doc_quick_start() (*asset, error) { + bytes, err := init_doc_quick_start_bytes() + if err != nil { + return nil, err + } + + info := bindata_file_info{name: "init-doc/quick-start", size: 1686, mode: os.FileMode(420), modTime: time.Unix(1435913360, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _init_doc_readme = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x9c\x53\xcb\x6e\x13\x41\x10\xbc\xef\x57\x54\x4e\x5c\x58\x73\x8f\xb8\x21\x21\x72\x00\x21\x1e\xca\x79\x32\xee\xf5\x8e\x3c\x3b\xbd\xcc\x03\x63\x29\x1f\xc0\x31\x91\x62\x22\x21\xf9\xe7\xf2\x25\x74\x0f\xb6\x49\xfc\x38\x90\x51\xcb\xea\x6d\x77\x55\x75\xd7\xec\xbe\x23\xef\x19\x26\x4c\x71\x49\xde\xf2\x40\xc8\x8c\x8b\x8f\x6f\x3f\x9f\x35\xcd\xc3\xaf\x9f\x1a\xab\xfb\x4d\xf2\x38\x56\xf7\x38\x52\x3d\xd5\x5d\xeb\x3b\xbe\xdb\x6d\x72\xf7\xb0\xba\xd1\xd8\x43\xee\xea\x9b\x58\x9f\xaa\x1f\x30\x3e\x11\xbc\xfb\x87\x7c\x3c\xf6\xc9\xb9\x4f\xcf\x57\xc5\x70\x50\x5d\x0b\xd7\xea\xf7\x93\x99\xb6\x0c\x87\x5c\xb7\xd0\x73\xf4\x69\x7f\x12\x41\x6f\x68\xd7\xbb\xe4\x6f\xff\xd1\xa7\x9b\x7d\x57\x9a\x8b\x0e\x4b\x2e\x2f\x22\x21\x11\xb9\x30\x43\xee\x5d\x7a\xa9\x35\xf4\xe6\xbb\x54\x8b\xb5\x94\x52\x57\xbc\x5f\xc2\x85\x94\x8d\xf7\x34\x6d\xf4\xda\xeb\xab\x60\x04\x19\x78\x21\x7f\x65\x8a\x9d\xb1\x4a\xb1\x70\xb9\x17\x1e\x82\x1b\xbb\x84\x81\xe2\x5c\x20\x66\x26\xaf\x09\xda\xe7\x9d\xe6\x1a\x97\x26\x06\x21\x3f\xc7\x7f\x9d\x6b\x41\x02\x5f\x64\x27\x48\x18\x3f\xf6\x06\x89\xbb\xbc\x90\xb9\x27\xf8\x9a\x08\x26\xeb\xb2\x11\xbc\x08\x98\xba\x64\x23\x65\xc7\xe1\x6c\x83\x7c\x5f\x6c\xaf\xc8\xc1\xa5\xa4\xab\x71\x84\x37\x76\xae\xe9\xc8\xde\xa5\x7e\x22\xe4\x24\x1e\xa8\x0f\x57\x65\x96\x26\x5b\xcd\x0f\x2c\xc4\x94\xc5\x56\x5b\x54\xeb\x13\x99\x69\x35\xa5\x16\x5c\x5e\x8a\x6d\x99\x12\x3a\xa1\x1c\x58\x3b\x14\xf9\x6c\x83\x9a\x37\x3d\xd9\x39\xb8\x88\xa2\x7e\x9a\xdc\x55\x31\x96\x9f\x88\xce\x79\x51\x72\xa1\x5e\xae\x6c\x19\xc9\x66\x8e\xcb\x73\xb9\x10\x4c\x5e\x99\x2b\x41\xd5\xac\x27\x3f\xd6\xe4\x5b\x71\x76\xde\xca\x65\xc7\x5c\x6d\x7c\xdd\xb6\x28\xc9\xcc\x08\xf4\xc3\x0c\xa3\xb0\xd5\xb6\x28\x3b\x89\xd6\xee\x68\x5b\x95\x50\xc1\xda\xb1\x5d\xb6\xad\xcb\x36\x7f\x02\x00\x00\xff\xff\x16\x13\x92\x0d\x43\x04\x00\x00") + +func init_doc_readme_bytes() ([]byte, error) { + return bindata_read( + _init_doc_readme, + "init-doc/readme", + ) +} + +func init_doc_readme() (*asset, error) { + bytes, err := init_doc_readme_bytes() + if err != nil { + return nil, err + } + + info := bindata_file_info{name: "init-doc/readme", size: 1091, mode: os.FileMode(420), modTime: time.Unix(1430739633, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _init_doc_security_notes = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x6c\x53\xbb\x72\xdb\x3a\x10\xed\xf9\x15\x7b\xdd\xb8\xd1\xe5\xdc\xdb\xa6\xca\x63\xe4\x8c\x1b\xdb\x63\x3b\xc9\xa4\x5c\x82\x2b\x11\x23\x10\xcb\xc1\x43\x0a\xff\x3e\x67\xc1\xc8\x49\x11\x8d\x0a\x0d\xb4\x38\xaf\x3d\xa0\xbf\x7c\xee\x9f\xee\x5e\xe8\x43\x58\x26\xa6\x17\x71\x35\xf9\xb2\xd2\x83\x16\xc9\x5d\xf7\x4d\xa8\xa4\x95\x26\x4e\x23\x15\x25\x89\xb9\x26\x21\xad\x89\xf2\x9a\x8b\xcc\xe4\x33\x65\x3e\x08\x71\x1c\x29\xe9\x50\x73\xd9\xd1\x50\x0b\x71\x08\x94\xf5\x50\x2e\x9c\xa4\x9b\x38\xe3\xf0\x98\x77\x24\x79\x11\xe7\xf1\xe7\x4a\x51\x2e\x6f\x13\x3d\xbd\x4e\x40\x1a\x7d\x2e\xc9\xe3\xba\xd7\x68\xc8\xb3\x70\x2c\xc6\x3b\x18\x41\xc7\x4d\xe2\x92\xe4\xec\xe5\xb2\xa3\x51\xe3\x6d\xa1\x9a\x85\x7c\xa1\x83\x26\x8c\xac\x65\xf2\xf1\x48\xb3\xcf\xd9\x20\x1c\xac\x78\xc7\xa1\xef\xba\xa7\x20\x8c\xc9\x08\x5b\x54\x26\xc1\x7c\x08\x7a\xc1\xf0\xbb\xae\xfb\x77\x63\xc7\x77\x63\xb8\xaa\x6a\xa6\x4c\x3b\x6e\x41\x82\x44\xe2\x3a\xfa\x22\x63\x4f\xf7\xc5\xc6\x2d\x87\xa3\x72\xe8\xc8\x44\x3a\x8d\x63\x75\xb0\x0e\x89\xba\x08\x22\xba\x86\xd9\xae\x91\x46\x27\x74\x11\x72\x41\x4d\x73\xc4\x01\x66\xff\xef\xff\xa3\x24\x4d\x5d\x6f\x52\xfc\x72\xd8\xa4\x20\xa0\x72\xd1\x74\x92\xd1\xf0\x8e\x89\xe7\x5d\x13\x34\xb3\xed\xe3\x2c\x80\x4f\x5e\x6b\xa6\x1a\x91\x9b\xd3\xb3\x24\x19\xa1\xe4\x5c\x43\x94\xc4\x83\x0f\x30\x2f\xf9\xaa\xf5\x02\x25\x05\x16\xc0\xfb\x59\x37\x24\x68\x19\xb5\x99\x93\x1f\x90\x5a\xcc\xf0\x0a\x04\x44\x9a\x8c\xf3\xec\x47\x90\x8f\x5c\xb8\xa7\x8f\xd8\xe9\xb2\x65\xb8\xa8\xc7\x56\x30\x6a\x33\x43\x90\xd9\x82\x68\x6b\x82\x18\xc0\x33\x20\x8e\xbe\x4c\x75\x00\x6f\xae\xb2\x23\xec\x46\x66\xf6\xe1\x2d\x91\xf7\xe6\xb2\xf7\x0a\x04\x7f\xe6\x22\x61\xfd\xed\x1d\xec\x19\x45\x73\x69\x5d\x5a\x0f\xda\x66\xd1\x26\xa7\xf3\x5c\x23\xd6\x69\xa7\x5b\xc9\x7c\xb9\xcd\xf4\xf0\xf8\x4a\x4f\xcf\x8f\x5f\xf7\x0f\xf4\xb2\xff\xf4\xe5\x79\x0f\xfa\xef\xfb\xd7\x7f\xc8\x8c\x5b\x58\x28\x4f\xd1\xd2\x3a\x37\x24\x3d\x49\xec\xe9\x0e\x98\x51\xd1\x21\xab\x82\xd3\x51\x2c\x21\x1f\x5d\xa8\xe6\x18\x4e\x66\x3e\x09\x70\x5a\xdb\x11\xd3\x00\x3d\xd3\xcc\xe9\xd4\x56\x6e\xcb\x6d\x2a\x90\x2a\x7c\xfe\x29\x16\xf6\x67\x1f\xad\x20\x71\xab\x59\x2d\x80\xd8\x59\x41\x26\x31\x2c\x0f\x27\xad\xcd\x74\x53\xa3\xbd\x9c\x1b\x9a\x8d\xdf\x5c\x4e\xfe\x38\x11\xb0\xf1\x7b\x66\x2b\x0b\x72\x4e\x8c\x1a\x10\x2f\x4b\xee\x01\x72\x7f\x00\xce\xaf\xaa\xd2\x10\xd4\x9d\xac\xee\x07\x61\x63\x69\x18\xab\xd6\xdd\x75\x51\x28\x64\x61\x67\x4f\xa4\xef\x7e\x06\x00\x00\xff\xff\x1e\xa8\xfc\x94\xf8\x03\x00\x00") + +func init_doc_security_notes_bytes() ([]byte, error) { + return bindata_read( + _init_doc_security_notes, + "init-doc/security-notes", + ) +} + +func init_doc_security_notes() (*asset, error) { + bytes, err := init_doc_security_notes_bytes() + if err != nil { + return nil, err + } + + info := bindata_file_info{name: "init-doc/security-notes", size: 1016, mode: os.FileMode(420), modTime: time.Unix(1427804268, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +// Asset loads and returns the asset for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func Asset(name string) ([]byte, error) { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) + } + return a.bytes, nil + } + return nil, fmt.Errorf("Asset %s not found", name) +} + +// MustAsset is like Asset but panics when Asset would return an error. +// It simplifies safe initialization of global variables. +func MustAsset(name string) []byte { + a, err := Asset(name) + if (err != nil) { + panic("asset: Asset(" + name + "): " + err.Error()) + } + + return a +} + +// AssetInfo loads and returns the asset info for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func AssetInfo(name string) (os.FileInfo, error) { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) + } + return a.info, nil + } + return nil, fmt.Errorf("AssetInfo %s not found", name) +} + +// AssetNames returns the names of the assets. +func AssetNames() []string { + names := make([]string, 0, len(_bindata)) + for name := range _bindata { + names = append(names, name) + } + return names +} + +// _bindata is a table, holding each asset generator, mapped to its name. +var _bindata = map[string]func() (*asset, error){ + "init-doc/about": init_doc_about, + "init-doc/contact": init_doc_contact, + "init-doc/help": init_doc_help, + "init-doc/quick-start": init_doc_quick_start, + "init-doc/readme": init_doc_readme, + "init-doc/security-notes": init_doc_security_notes, +} + +// AssetDir returns the file names below a certain +// directory embedded in the file by go-bindata. +// For example if you run go-bindata on data/... and data contains the +// following hierarchy: +// data/ +// foo.txt +// img/ +// a.png +// b.png +// then AssetDir("data") would return []string{"foo.txt", "img"} +// AssetDir("data/img") would return []string{"a.png", "b.png"} +// AssetDir("foo.txt") and AssetDir("notexist") would return an error +// AssetDir("") will return []string{"data"}. +func AssetDir(name string) ([]string, error) { + node := _bintree + if len(name) != 0 { + cannonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(cannonicalName, "/") + for _, p := range pathList { + node = node.Children[p] + if node == nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + } + } + if node.Func != nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + rv := make([]string, 0, len(node.Children)) + for childName := range node.Children { + rv = append(rv, childName) + } + return rv, nil +} + +type _bintree_t struct { + Func func() (*asset, error) + Children map[string]*_bintree_t +} +var _bintree = &_bintree_t{nil, map[string]*_bintree_t{ + "init-doc": &_bintree_t{nil, map[string]*_bintree_t{ + "about": &_bintree_t{init_doc_about, map[string]*_bintree_t{ + }}, + "contact": &_bintree_t{init_doc_contact, map[string]*_bintree_t{ + }}, + "help": &_bintree_t{init_doc_help, map[string]*_bintree_t{ + }}, + "quick-start": &_bintree_t{init_doc_quick_start, map[string]*_bintree_t{ + }}, + "readme": &_bintree_t{init_doc_readme, map[string]*_bintree_t{ + }}, + "security-notes": &_bintree_t{init_doc_security_notes, map[string]*_bintree_t{ + }}, + }}, +}} + +// Restore an asset under the given directory +func RestoreAsset(dir, name string) error { + data, err := Asset(name) + if err != nil { + return err + } + info, err := AssetInfo(name) + if err != nil { + return err + } + err = os.MkdirAll(_filePath(dir, path.Dir(name)), os.FileMode(0755)) + if err != nil { + return err + } + err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) + if err != nil { + return err + } + err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) + if err != nil { + return err + } + return nil +} + +// Restore assets under the given directory recursively +func RestoreAssets(dir, name string) error { + children, err := AssetDir(name) + if err != nil { // File + return RestoreAsset(dir, name) + } else { // Dir + for _, child := range children { + err = RestoreAssets(dir, path.Join(name, child)) + if err != nil { + return err + } + } + } + return nil +} + +func _filePath(dir, name string) string { + cannonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) +} + diff --git a/assets/contact.go b/assets/contact.go deleted file mode 100644 index 76db8d2b1..000000000 --- a/assets/contact.go +++ /dev/null @@ -1,9 +0,0 @@ -package assets - -var Init_doc_contact = `Come hang out in our IRC chat room if you have any questions. - -Contact the ipfs dev team: -- Bugs: https://github.com/ipfs/go-ipfs/issues -- Help: irc.freenode.org/#ipfs -- Email: dev@ipfs.io -` diff --git a/assets/help.go b/assets/help.go deleted file mode 100644 index 8ca5fb255..000000000 --- a/assets/help.go +++ /dev/null @@ -1,10 +0,0 @@ -package assets - -var Init_doc_help = `Some helpful resources for finding your way around ipfs: - -- quick-start: a quick show of various ipfs features. -- ipfs commands: a list of all commands -- ipfs --help: every command describes itself -- https://github.com/ipfs/go-ipfs -- the src repository -- #ipfs on irc.freenode.org -- the community irc channel -` diff --git a/assets/init-doc/quick-start b/assets/init-doc/quick-start index 8d1f250ec..b01559bff 100644 --- a/assets/init-doc/quick-start +++ b/assets/init-doc/quick-start @@ -1,6 +1,6 @@ # 0.1 - Quick Start -This is a set of short examples with minmal explanation. It is meant as +This is a set of short examples with minimal explanation. It is meant as a "quick start". Soon, we'll write a longer tour :-) diff --git a/assets/quick-start.go b/assets/quick-start.go deleted file mode 100644 index dfcac006b..000000000 --- a/assets/quick-start.go +++ /dev/null @@ -1,115 +0,0 @@ -package assets - -var Init_doc_quick_start = `# 0.1 - Quick Start - -This is a set of short examples with minmal explanation. It is meant as -a "quick start". Soon, we'll write a longer tour :-) - - -Add a file to ipfs: - - echo "hello world" >hello - ipfs add hello - - -View it: - - ipfs cat - - -Try a directory: - - mkdir foo - mkdir foo/bar - echo "baz" > foo/baz - echo "baz" > foo/bar/baz - ipfs add -r foo - - -View things: - - ipfs ls - ipfs ls /bar - ipfs cat /baz - ipfs cat /bar/baz - ipfs cat /bar - ipfs ls /baz - - -References: - - ipfs refs - ipfs refs -r - ipfs refs --help - - -Get: - - ipfs get foo2 - diff foo foo2 - - -Objects: - - ipfs object get - ipfs object get /foo2 - ipfs object --help - - -Pin + GC: - - ipfs pin -r - ipfs gc - ipfs ls - ipfs unpin -r - ipfs gc - - -Daemon: - - ipfs daemon (in another terminal) - ipfs id - - -Network: - - (must be online) - ipfs swarm peers - ipfs id - ipfs cat - - -Mount: - - (warning: fuse is finicky!) - ipfs mount - cd /ipfs/< - - -Tool: - - ipfs version - ipfs update - ipfs commands - ipfs config --help - open http://localhost:5001/webui - - -Browse: - - webui: - - http://localhost:5001/webui - - video: - - http://localhost:8080/ipfs/QmVc6zuAneKJzicnJpfrqCH9gSy6bz54JhcypfJYhGUFQu/play#/ipfs/QmTKZgRNwDNZwHtJSjCp6r5FYefzpULfy37JvMt9DwvXse - - images: - - http://localhost:8080/ipfs/QmZpc3HvfjEXvLWGQPWbHk3AjD5j8NEN4gmFN8Jmrd5g83/cs - - markdown renderer app: - - http://localhost:8080/ipfs/QmX7M9CiYXjVeFnkfVGf3y5ixTZ2ACeSGyL1vBJY1HvQPp/mdown -` diff --git a/assets/readme.go b/assets/readme.go deleted file mode 100644 index fe7139317..000000000 --- a/assets/readme.go +++ /dev/null @@ -1,29 +0,0 @@ -package assets - -var Init_doc_readme = `Hello and Welcome to IPFS! - -██╗██████╗ ███████╗███████╗ -██║██╔══██╗██╔════╝██╔════╝ -██║██████╔╝█████╗ ███████╗ -██║██╔═══╝ ██╔══╝ ╚════██║ -██║██║ ██║ ███████║ -╚═╝╚═╝ ╚═╝ ╚══════╝ - -If you're seeing this, you have successfully installed -IPFS and are now interfacing with the ipfs merkledag! - - ------------------------------------------------------- -| Warning: | -| This is alpha software. use at your own discretion! | -| Much is missing or lacking polish. There are bugs. | -| Not yet secure. Read the security notes for more. | - ------------------------------------------------------- - -Check out some of the other files in this directory: - - ./about - ./help - ./quick-start <-- usage examples - ./readme <-- this file - ./security-notes -` diff --git a/assets/security-notes.go b/assets/security-notes.go deleted file mode 100644 index e3253a30e..000000000 --- a/assets/security-notes.go +++ /dev/null @@ -1,24 +0,0 @@ -package assets - -var Init_doc_security_notes = ` IPFS Alpha Security Notes - -We try hard to ensure our system is safe and robust, but all software -has bugs, especially new software. This distribution is meant to be an -alpha preview, don't use it for anything mission critical. - -Please note the following: - -- This is alpha software and has not been audited. It is our goal - to conduct a proper security audit once we close in on a 1.0 release. - -- ipfs is a networked program, and may have serious undiscovered - vulnerabilities. It is written in Go, and we do not execute any - user provided data. But please point any problems out to us in a - github issue, or email security@ipfs.io privately. - -- ipfs uses encryption for all communication, but it's NOT PROVEN SECURE - YET! It may be totally broken. For now, the code is included to make - sure we benchmark our operations with encryption in mind. In the future, - there will be an "unsafe" mode for high performance intranet apps. - If this is a blocking feature for you, please contact us. -` diff --git a/cmd/ipfs/init.go b/cmd/ipfs/init.go index 40f95c3ce..c4d0d7b4a 100644 --- a/cmd/ipfs/init.go +++ b/cmd/ipfs/init.go @@ -1,7 +1,6 @@ package main import ( - "bytes" "errors" "fmt" "io" @@ -10,14 +9,11 @@ import ( context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context" assets "github.com/ipfs/go-ipfs/assets" - key "github.com/ipfs/go-ipfs/blocks/key" cmds "github.com/ipfs/go-ipfs/commands" core "github.com/ipfs/go-ipfs/core" - coreunix "github.com/ipfs/go-ipfs/core/coreunix" namesys "github.com/ipfs/go-ipfs/namesys" config "github.com/ipfs/go-ipfs/repo/config" fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo" - uio "github.com/ipfs/go-ipfs/unixfs/io" ) const nBitsForKeypairDefault = 2048 @@ -167,34 +163,9 @@ func addDefaultAssets(out io.Writer, repoRoot string) error { } defer nd.Close() - dirb := uio.NewDirectory(nd.DAG) - - // add every file in the assets pkg - for fname, file := range assets.Init_dir { - buf := bytes.NewBufferString(file) - s, err := coreunix.Add(nd, buf) - if err != nil { - return err - } - - k := key.B58KeyDecode(s) - if err := dirb.AddChild(fname, k); err != nil { - return err - } - } - - dir := dirb.GetNode() - dkey, err := nd.DAG.Add(dir) + dkey, err := assets.SeedInitDocs(nd) if err != nil { - return err - } - - if err := nd.Pinning.Pin(ctx, dir, true); err != nil { - return err - } - - if err := nd.Pinning.Flush(); err != nil { - return err + return fmt.Errorf("init: seeding init docs failed: %s", err) } if _, err = fmt.Fprintf(out, "to get started, enter:\n"); err != nil { diff --git a/test/sharness/lib/test-lib-hashes.sh b/test/sharness/lib/test-lib-hashes.sh index ae3b1f1ae..0ef165ad8 100644 --- a/test/sharness/lib/test-lib-hashes.sh +++ b/test/sharness/lib/test-lib-hashes.sh @@ -1,6 +1,6 @@ # this file defines several useful hashes used across the test codebase. # thus they can be defined + changed in one place -HASH_WELCOME_DOCS="Qmcqtw8FfrVSBaRmbWwHxt3AuySBhJLcvmFYi3Lbc4xnwj" +HASH_WELCOME_DOCS="QmVtU7ths96fMgZ8YSZAbKghyieq7AjxNdcqyVzxTt3qVe" HASH_HELP_PAGE="QmY5heUM5qgRubMDD1og9fhCPA6QdkMp3QCwd4s7gJsyE7" HASH_EMPTY_DIR="QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn"