Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit da03761

Browse files
committed
Merge pull request #91 from noffle/init
'init' implementation.
2 parents 3b945e1 + fca76b0 commit da03761

16 files changed

+603
-15
lines changed

default-config.json

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"Addresses": {
3+
"Swarm": [
4+
"/ip4/0.0.0.0/tcp/4001",
5+
"/ip6/::/tcp/4001"
6+
],
7+
"API": "/ip4/127.0.0.1/tcp/5001",
8+
"Gateway": "/ip4/127.0.0.1/tcp/8080"
9+
},
10+
"Discovery": {
11+
"MDNS": {
12+
"Enabled": true,
13+
"Interval": 10
14+
}
15+
},
16+
"Mounts": {
17+
"IPFS": "/ipfs",
18+
"IPNS": "/ipns"
19+
},
20+
"Ipns": {
21+
"ResolveCacheSize": 128
22+
},
23+
"Gateway": {
24+
"RootRedirect": "",
25+
"Writable": false
26+
},
27+
"Bootstrap": [
28+
"/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
29+
"/ip4/104.236.176.52/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z",
30+
"/ip4/104.236.179.241/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM",
31+
"/ip4/162.243.248.213/tcp/4001/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm",
32+
"/ip4/128.199.219.111/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu",
33+
"/ip4/104.236.76.40/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64",
34+
"/ip4/178.62.158.247/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd",
35+
"/ip4/178.62.61.185/tcp/4001/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3",
36+
"/ip4/104.236.151.122/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx"
37+
]
38+
}

init-doc/about

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
2+
IPFS -- Inter-Planetary File system
3+
4+
IPFS is a global, versioned, peer-to-peer filesystem. It combines good ideas
5+
from Git, BitTorrent, Kademlia, SFS, and the Web. It is like a single bit-
6+
torrent swarm, exchanging git objects. IPFS provides an interface as simple
7+
as the HTTP web, but with permanence built in. You can also mount the world
8+
at /ipfs.
9+
10+
IPFS is a protocol:
11+
- defines a content-addressed file system
12+
- coordinates content delivery
13+
- combines Kademlia + BitTorrent + Git
14+
15+
IPFS is a filesystem:
16+
- has directories and files
17+
- mountable filesystem (via FUSE)
18+
19+
IPFS is a web:
20+
- can be used to view documents like the web
21+
- files accessible via HTTP at `http://ipfs.io/<path>`
22+
- browsers or extensions can learn to use `ipfs://` directly
23+
- hash-addressed content guarantees authenticity
24+
25+
IPFS is modular:
26+
- connection layer over any network protocol
27+
- routing layer
28+
- uses a routing layer DHT (kademlia/coral)
29+
- uses a path-based naming service
30+
- uses bittorrent-inspired block exchange
31+
32+
IPFS uses crypto:
33+
- cryptographic-hash content addressing
34+
- block-level deduplication
35+
- file integrity + versioning
36+
- filesystem-level encryption + signing support
37+
38+
IPFS is p2p:
39+
- worldwide peer-to-peer file transfers
40+
- completely decentralized architecture
41+
- **no** central point of failure
42+
43+
IPFS is a cdn:
44+
- add a file to the filesystem locally, and it's now available to the world
45+
- caching-friendly (content-hash naming)
46+
- bittorrent-based bandwidth distribution
47+
48+
IPFS has a name service:
49+
- IPNS, an SFS inspired name system
50+
- global namespace based on PKI
51+
- serves to build trust chains
52+
- compatible with other NSes
53+
- can map DNS, .onion, .bit, etc to IPNS

init-doc/contact

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Come hang out in our IRC chat room if you have any questions.
2+
3+
Contact the ipfs dev team:
4+
- Bugs: https://github.com/ipfs/go-ipfs/issues
5+
- Help: irc.freenode.org/#ipfs
6+

init-doc/docs/index

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Index

init-doc/help

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Some helpful resources for finding your way around ipfs:
2+
3+
- quick-start: a quick show of various ipfs features.
4+
- ipfs commands: a list of all commands
5+
- ipfs --help: every command describes itself
6+
- https://github.com/ipfs/go-ipfs -- the src repository
7+
- #ipfs on irc.freenode.org -- the community irc channel

init-doc/quick-start

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# 0.1 - Quick Start
2+
3+
This is a set of short examples with minimal explanation. It is meant as
4+
a "quick start". Soon, we'll write a longer tour :-)
5+
6+
7+
Add a file to ipfs:
8+
9+
echo "hello world" >hello
10+
ipfs add hello
11+
12+
13+
View it:
14+
15+
ipfs cat <the-hash-you-got-here>
16+
17+
18+
Try a directory:
19+
20+
mkdir foo
21+
mkdir foo/bar
22+
echo "baz" > foo/baz
23+
echo "baz" > foo/bar/baz
24+
ipfs add -r foo
25+
26+
27+
View things:
28+
29+
ipfs ls <the-hash-here>
30+
ipfs ls <the-hash-here>/bar
31+
ipfs cat <the-hash-here>/baz
32+
ipfs cat <the-hash-here>/bar/baz
33+
ipfs cat <the-hash-here>/bar
34+
ipfs ls <the-hash-here>/baz
35+
36+
37+
References:
38+
39+
ipfs refs <the-hash-here>
40+
ipfs refs -r <the-hash-here>
41+
ipfs refs --help
42+
43+
44+
Get:
45+
46+
ipfs get <the-hash-here> -o foo2
47+
diff foo foo2
48+
49+
50+
Objects:
51+
52+
ipfs object get <the-hash-here>
53+
ipfs object get <the-hash-here>/foo2
54+
ipfs object --help
55+
56+
57+
Pin + GC:
58+
59+
ipfs pin add <the-hash-here>
60+
ipfs repo gc
61+
ipfs ls <the-hash-here>
62+
ipfs pin rm <the-hash-here>
63+
ipfs repo gc
64+
65+
66+
Daemon:
67+
68+
ipfs daemon (in another terminal)
69+
ipfs id
70+
71+
72+
Network:
73+
74+
(must be online)
75+
ipfs swarm peers
76+
ipfs id
77+
ipfs cat <hash-of-remote-object>
78+
79+
80+
Mount:
81+
82+
(warning: fuse is finicky!)
83+
ipfs mount
84+
cd /ipfs/<the-hash-here>
85+
ls
86+
87+
88+
Tool:
89+
90+
ipfs version
91+
ipfs update
92+
ipfs commands
93+
ipfs config --help
94+
open http://localhost:5001/webui
95+
96+
97+
Browse:
98+
99+
webui:
100+
101+
http://localhost:5001/webui
102+
103+
video:
104+
105+
http://localhost:8080/ipfs/QmVc6zuAneKJzicnJpfrqCH9gSy6bz54JhcypfJYhGUFQu/play#/ipfs/QmTKZgRNwDNZwHtJSjCp6r5FYefzpULfy37JvMt9DwvXse
106+
107+
images:
108+
109+
http://localhost:8080/ipfs/QmZpc3HvfjEXvLWGQPWbHk3AjD5j8NEN4gmFN8Jmrd5g83/cs
110+
111+
markdown renderer app:
112+
113+
http://localhost:8080/ipfs/QmX7M9CiYXjVeFnkfVGf3y5ixTZ2ACeSGyL1vBJY1HvQPp/mdown

init-doc/readme

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Hello and Welcome to IPFS!
2+
3+
██╗██████╗ ███████╗███████╗
4+
██║██╔══██╗██╔════╝██╔════╝
5+
██║██████╔╝█████╗ ███████╗
6+
██║██╔═══╝ ██╔══╝ ╚════██║
7+
██║██║ ██║ ███████║
8+
╚═╝╚═╝ ╚═╝ ╚══════╝
9+
10+
If you're seeing this, you have successfully installed
11+
IPFS and are now interfacing with the ipfs merkledag!
12+
13+
-------------------------------------------------------
14+
| Warning: |
15+
| This is alpha software. Use at your own discretion! |
16+
| Much is missing or lacking polish. There are bugs. |
17+
| Not yet secure. Read the security notes for more. |
18+
-------------------------------------------------------
19+
20+
Check out some of the other files in this directory:
21+
22+
./about
23+
./help
24+
./quick-start <-- usage examples
25+
./readme <-- this file
26+
./security-notes

init-doc/security-notes

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
IPFS Alpha Security Notes
2+
3+
We try hard to ensure our system is safe and robust, but all software
4+
has bugs, especially new software. This distribution is meant to be an
5+
alpha preview, don't use it for anything mission critical.
6+
7+
Please note the following:
8+
9+
- This is alpha software and has not been audited. It is our goal
10+
to conduct a proper security audit once we close in on a 1.0 release.
11+
12+
- ipfs is a networked program, and may have serious undiscovered
13+
vulnerabilities. It is written in Go, and we do not execute any
14+
user provided data. But please point any problems out to us in a
15+
github issue, or email [email protected] privately.
16+
17+
- ipfs uses encryption for all communication, but it's NOT PROVEN SECURE
18+
YET! It may be totally broken. For now, the code is included to make
19+
sure we benchmark our operations with encryption in mind. In the future,
20+
there will be an "unsafe" mode for high performance intranet apps.
21+
If this is a blocking feature for you, please contact us.

init-doc/tour/0.0-intro

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
WIP
2+
3+
# 0.0 - Introduction
4+
5+
Welcome to IPFS! This tour will guide you through a few of the
6+
features of this tool, and the most common commands. Then, it will
7+
immerse you into the world of merkledags and the amazing things
8+
you can do with them.
9+
10+
11+
This tour has many parts, and can be taken in different sequences.
12+
Different people learn different ways, so choose your own adventure:
13+
14+
To start with the concepts, try:
15+
- The Merkle DAG
16+
- Data Structures on the Merkle DAG
17+
- Representing Files with unixfs
18+
- add, cat, ls, refs
19+
...
20+
21+
22+
To start with the examples, try:
23+
- add, cat, ls, refs
24+
- Representing Files with unixfs
25+
- Data Structures on the Merkle DAG
26+
- The Merkle DAG
27+
...
28+
29+
30+
To start with the network, try:
31+
- IPFS Nodes
32+
- Running the daemon
33+
- The Swarm
34+
- The Web

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@
8282
"hapi": "^12.0.0",
8383
"ipfs-api": "^2.13.1",
8484
"ipfs-blocks": "^0.1.0",
85-
"ipfs-data-importing": "^0.3.0",
85+
"ipfs-data-importing": "^0.3.3",
8686
"ipfs-merkle-dag": "^0.2.1",
8787
"ipfs-multipart": "^0.1.0",
8888
"ipfs-repo": "^0.5.0",
8989
"joi": "^8.0.2",
9090
"libp2p-ipfs": "^0.2.0",
9191
"lodash.get": "^4.0.0",
9292
"lodash.set": "^4.0.0",
93-
"peer-id": "^0.6.0",
93+
"peer-id": "^0.6.1",
9494
"peer-info": "^0.6.0",
9595
"ronin": "^0.3.11",
9696
"temp": "^0.8.3"

src/core/index.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
'use strict'
22

33
const defaultRepo = require('./default-repo')
4-
// const bl = require('bl')
54
const blocks = require('ipfs-blocks')
65
const BlockService = blocks.BlockService
76
const Block = blocks.Block
87
const mDAG = require('ipfs-merkle-dag')
98
const DAGNode = mDAG.DAGNode
109
const DAGService = mDAG.DAGService
11-
const Id = require('peer-id')
12-
const Info = require('peer-info')
10+
const peerId = require('peer-id')
11+
const PeerInfo = require('peer-info')
1312
const multiaddr = require('multiaddr')
1413
const importer = require('ipfs-data-importing').import
1514
const libp2p = require('libp2p-ipfs')
15+
const init = require('./init')
1616

1717
exports = module.exports = IPFS
1818

@@ -40,8 +40,8 @@ function IPFS (repo) {
4040
if (err) {
4141
throw err
4242
}
43-
const pid = Id.createFromPrivKey(config.Identity.PrivKey)
44-
peerInfo = new Info(pid)
43+
const pid = peerId.createFromPrivKey(config.Identity.PrivKey)
44+
peerInfo = new PeerInfo(pid)
4545
config.Addresses.Swarm.forEach((addr) => {
4646
peerInfo.multiaddr.add(multiaddr(addr))
4747
})
@@ -107,6 +107,8 @@ function IPFS (repo) {
107107
gc: function () {}
108108
}
109109

110+
this.init = (opts, callback) => { init(repo, opts, callback) }
111+
110112
this.bootstrap = {
111113
list: (callback) => {
112114
repo.config.get((err, config) => {

0 commit comments

Comments
 (0)