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

Commit

Permalink
Merge pull request #91 from noffle/init
Browse files Browse the repository at this point in the history
'init' implementation.
  • Loading branch information
daviddias committed Mar 24, 2016
2 parents 3b945e1 + fca76b0 commit da03761
Show file tree
Hide file tree
Showing 16 changed files with 603 additions and 15 deletions.
38 changes: 38 additions & 0 deletions default-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"Addresses": {
"Swarm": [
"/ip4/0.0.0.0/tcp/4001",
"/ip6/::/tcp/4001"
],
"API": "/ip4/127.0.0.1/tcp/5001",
"Gateway": "/ip4/127.0.0.1/tcp/8080"
},
"Discovery": {
"MDNS": {
"Enabled": true,
"Interval": 10
}
},
"Mounts": {
"IPFS": "/ipfs",
"IPNS": "/ipns"
},
"Ipns": {
"ResolveCacheSize": 128
},
"Gateway": {
"RootRedirect": "",
"Writable": false
},
"Bootstrap": [
"/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
"/ip4/104.236.176.52/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z",
"/ip4/104.236.179.241/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM",
"/ip4/162.243.248.213/tcp/4001/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm",
"/ip4/128.199.219.111/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu",
"/ip4/104.236.76.40/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64",
"/ip4/178.62.158.247/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd",
"/ip4/178.62.61.185/tcp/4001/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3",
"/ip4/104.236.151.122/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx"
]
}
53 changes: 53 additions & 0 deletions init-doc/about
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

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/<path>`
- 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
6 changes: 6 additions & 0 deletions init-doc/contact
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
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: [email protected]
1 change: 1 addition & 0 deletions init-doc/docs/index
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Index
7 changes: 7 additions & 0 deletions init-doc/help
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
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
113 changes: 113 additions & 0 deletions init-doc/quick-start
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# 0.1 - Quick Start

This is a set of short examples with minimal 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 <the-hash-you-got-here>


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 <the-hash-here>
ipfs ls <the-hash-here>/bar
ipfs cat <the-hash-here>/baz
ipfs cat <the-hash-here>/bar/baz
ipfs cat <the-hash-here>/bar
ipfs ls <the-hash-here>/baz


References:

ipfs refs <the-hash-here>
ipfs refs -r <the-hash-here>
ipfs refs --help


Get:

ipfs get <the-hash-here> -o foo2
diff foo foo2


Objects:

ipfs object get <the-hash-here>
ipfs object get <the-hash-here>/foo2
ipfs object --help


Pin + GC:

ipfs pin add <the-hash-here>
ipfs repo gc
ipfs ls <the-hash-here>
ipfs pin rm <the-hash-here>
ipfs repo gc


Daemon:

ipfs daemon (in another terminal)
ipfs id


Network:

(must be online)
ipfs swarm peers
ipfs id
ipfs cat <hash-of-remote-object>


Mount:

(warning: fuse is finicky!)
ipfs mount
cd /ipfs/<the-hash-here>
ls


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
26 changes: 26 additions & 0 deletions init-doc/readme
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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
21 changes: 21 additions & 0 deletions init-doc/security-notes
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
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 [email protected] 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.
34 changes: 34 additions & 0 deletions init-doc/tour/0.0-intro
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
WIP

# 0.0 - Introduction

Welcome to IPFS! This tour will guide you through a few of the
features of this tool, and the most common commands. Then, it will
immerse you into the world of merkledags and the amazing things
you can do with them.


This tour has many parts, and can be taken in different sequences.
Different people learn different ways, so choose your own adventure:

To start with the concepts, try:
- The Merkle DAG
- Data Structures on the Merkle DAG
- Representing Files with unixfs
- add, cat, ls, refs
...


To start with the examples, try:
- add, cat, ls, refs
- Representing Files with unixfs
- Data Structures on the Merkle DAG
- The Merkle DAG
...


To start with the network, try:
- IPFS Nodes
- Running the daemon
- The Swarm
- The Web
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@
"hapi": "^12.0.0",
"ipfs-api": "^2.13.1",
"ipfs-blocks": "^0.1.0",
"ipfs-data-importing": "^0.3.0",
"ipfs-data-importing": "^0.3.3",
"ipfs-merkle-dag": "^0.2.1",
"ipfs-multipart": "^0.1.0",
"ipfs-repo": "^0.5.0",
"joi": "^8.0.2",
"libp2p-ipfs": "^0.2.0",
"lodash.get": "^4.0.0",
"lodash.set": "^4.0.0",
"peer-id": "^0.6.0",
"peer-id": "^0.6.1",
"peer-info": "^0.6.0",
"ronin": "^0.3.11",
"temp": "^0.8.3"
Expand Down
12 changes: 7 additions & 5 deletions src/core/index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
'use strict'

const defaultRepo = require('./default-repo')
// const bl = require('bl')
const blocks = require('ipfs-blocks')
const BlockService = blocks.BlockService
const Block = blocks.Block
const mDAG = require('ipfs-merkle-dag')
const DAGNode = mDAG.DAGNode
const DAGService = mDAG.DAGService
const Id = require('peer-id')
const Info = require('peer-info')
const peerId = require('peer-id')
const PeerInfo = require('peer-info')
const multiaddr = require('multiaddr')
const importer = require('ipfs-data-importing').import
const libp2p = require('libp2p-ipfs')
const init = require('./init')

exports = module.exports = IPFS

Expand Down Expand Up @@ -40,8 +40,8 @@ function IPFS (repo) {
if (err) {
throw err
}
const pid = Id.createFromPrivKey(config.Identity.PrivKey)
peerInfo = new Info(pid)
const pid = peerId.createFromPrivKey(config.Identity.PrivKey)
peerInfo = new PeerInfo(pid)
config.Addresses.Swarm.forEach((addr) => {
peerInfo.multiaddr.add(multiaddr(addr))
})
Expand Down Expand Up @@ -107,6 +107,8 @@ function IPFS (repo) {
gc: function () {}
}

this.init = (opts, callback) => { init(repo, opts, callback) }

this.bootstrap = {
list: (callback) => {
repo.config.get((err, config) => {
Expand Down
Loading

0 comments on commit da03761

Please sign in to comment.