diff --git a/.aegir.js b/.aegir.js index be71ece3bd..e3891ff71a 100644 --- a/.aegir.js +++ b/.aegir.js @@ -10,7 +10,7 @@ const preloadNode = MockPreloadNode.createNode() const echoServer = EchoServer.createServer() module.exports = { - bundlesize: { maxSize: '685kB' }, + bundlesize: { maxSize: '650kB' }, webpack: { resolve: { mainFields: ['browser', 'main'], diff --git a/README.md b/README.md index 908c21d2e8..20589b2ee4 100644 --- a/README.md +++ b/README.md @@ -284,6 +284,18 @@ Example: const node = await IPFS.create({ repo: '/var/ipfs/data' }) ``` +##### `options.repoAutoMigrate` + +| Type | Default | +|------|---------| +| boolean | `true` | + +`js-ipfs` comes bundled with a tool that automatically migrates your IPFS repository when a new version is available. + +**For apps that build on top of `js-ipfs` and run in the browser environment, be aware that disabling automatic +migrations leaves the user with no way to run the migrations because there is no CLI in the browser. In such +a case, you should provide a way to trigger migrations manually.** + ##### `options.init` | Type | Default | diff --git a/package.json b/package.json index b25720bb48..e96b61f46e 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "ipfs-http-response": "~0.4.0", "ipfs-mfs": "^0.13.0", "ipfs-multipart": "^0.2.0", - "ipfs-repo": "^0.28.1", + "ipfs-repo": "^0.29.0", "ipfs-unixfs": "~0.1.16", "ipfs-unixfs-exporter": "^0.38.0", "ipfs-unixfs-importer": "^0.40.0", diff --git a/src/cli/bin.js b/src/cli/bin.js index edb4e1a2f2..f43855758c 100755 --- a/src/cli/bin.js +++ b/src/cli/bin.js @@ -26,6 +26,7 @@ if (!semver.satisfies(process.versions.node, pkg.engines.node)) { const YargsPromise = require('yargs-promise') const updateNotifier = require('update-notifier') const debug = require('debug')('ipfs:cli') +const { errors: { InvalidRepoVersionError } } = require('ipfs-repo') const parser = require('./parser') const commandAlias = require('./command-alias') const { print } = require('./utils') @@ -50,6 +51,11 @@ cli }) .catch(({ error, argv }) => { getIpfs = argv && argv.getIpfs + + if (error.code === InvalidRepoVersionError.code) { + error.message = 'Incompatible repo version. Migration needed. Pass --migrate for automatic migration' + } + if (error.message) { print(error.message) debug(error) @@ -57,6 +63,7 @@ cli print('Unknown error, please re-run the command with DEBUG=ipfs:cli to see debug output') debug(error) } + process.exit(1) }) .finally(() => { diff --git a/src/cli/commands/daemon.js b/src/cli/commands/daemon.js index b1e8aef26a..f018362e99 100644 --- a/src/cli/commands/daemon.js +++ b/src/cli/commands/daemon.js @@ -73,6 +73,7 @@ module.exports = { config, silent: argv.silent, repo: process.env.IPFS_PATH, + repoAutoMigrate: argv.migrate, offline: argv.offline, pass: argv.pass, preload: { enabled: argv.enablePreload }, @@ -96,10 +97,8 @@ module.exports = { print(`Web UI available at ${toUri(apiServer.info.ma)}/webui`) }) } catch (err) { - if (err.code === 'ENOENT' && err.message.match(/uninitialized/i)) { - print('Error: no initialized ipfs repo found in ' + repoPath) - print('please run: jsipfs init') - process.exit(1) + if (err.code === 'ERR_REPO_NOT_INITIALIZED' || err.message.match(/uninitialized/i)) { + err.message = 'no initialized ipfs repo found in ' + repoPath + '\nplease run: jsipfs init' } throw err } diff --git a/src/cli/daemon.js b/src/cli/daemon.js index 6fe2083e36..c2dc556a03 100644 --- a/src/cli/daemon.js +++ b/src/cli/daemon.js @@ -54,17 +54,8 @@ class Daemon { } // start the daemon - const ipfsOpts = Object.assign({ }, { init: true, start: true, libp2p }, this._options) - const ipfs = new IPFS(ipfsOpts) - - await new Promise((resolve, reject) => { - ipfs.once('error', err => { - this._log('error starting core', err) - err.code = 'ENOENT' - reject(err) - }) - ipfs.once('start', resolve) - }) + const ipfsOpts = Object.assign({}, { init: true, start: true, libp2p }, this._options) + const ipfs = await IPFS.create(ipfsOpts) this._ipfs = ipfs diff --git a/src/cli/parser.js b/src/cli/parser.js index 25a1ca6305..f28979feec 100644 --- a/src/cli/parser.js +++ b/src/cli/parser.js @@ -19,6 +19,11 @@ const parser = yargs type: 'string', default: '' }) + .option('migrate', { + desc: 'Enable/disable automatic repo migrations', + type: 'boolean', + default: false + }) .epilog(utils.ipfsPathHelp) .demandCommand(1) .fail((msg, err, yargs) => { diff --git a/src/cli/utils.js b/src/cli/utils.js index 842acd3d61..b53c4b4799 100644 --- a/src/cli/utils.js +++ b/src/cli/utils.js @@ -4,9 +4,7 @@ const fs = require('fs') const os = require('os') const multiaddr = require('multiaddr') const path = require('path') -const debug = require('debug') -const log = debug('cli') -log.error = debug('cli:error') +const log = require('debug')('ipfs:cli:utils') const Progress = require('progress') const byteman = require('byteman') const promisify = require('promisify-es6') @@ -47,6 +45,7 @@ exports.getIPFS = (argv, callback) => { const IPFS = require('../core') const node = new IPFS({ silent: argv.silent, + repoAutoMigrate: argv.migrate, repo: exports.getRepoPath(), init: false, start: false, @@ -60,7 +59,7 @@ exports.getIPFS = (argv, callback) => { }) node.on('error', (err) => { - throw err + callback(err) }) node.once('ready', () => { diff --git a/src/core/config.js b/src/core/config.js index d0070d1a32..6f2353efb1 100644 --- a/src/core/config.js +++ b/src/core/config.js @@ -28,6 +28,7 @@ const s = superstruct({ const configSchema = s({ repo: optional(s('object|string')), repoOwner: 'boolean?', + repoAutoMigrate: 'boolean?', preload: s({ enabled: 'boolean?', addresses: optional(s(['multiaddr'])), diff --git a/src/core/index.js b/src/core/index.js index 1d2483a3b9..a5ad33edf9 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -70,7 +70,7 @@ class IPFS extends EventEmitter { if (typeof options.repo === 'string' || options.repo === undefined) { - this._repo = defaultRepo(options.repo) + this._repo = defaultRepo(options) } else { this._repo = options.repo } diff --git a/src/core/runtime/repo-browser.js b/src/core/runtime/repo-browser.js index bcfe6b8489..8bd0f330e2 100644 --- a/src/core/runtime/repo-browser.js +++ b/src/core/runtime/repo-browser.js @@ -2,7 +2,7 @@ const IPFSRepo = require('ipfs-repo') -module.exports = (dir) => { - const repoPath = dir || 'ipfs' - return new IPFSRepo(repoPath) +module.exports = (options) => { + const repoPath = options.repo || 'ipfs' + return new IPFSRepo(repoPath, { autoMigrate: options.repoAutoMigrate }) } diff --git a/src/core/runtime/repo-nodejs.js b/src/core/runtime/repo-nodejs.js index 751689cbac..431d59b377 100644 --- a/src/core/runtime/repo-nodejs.js +++ b/src/core/runtime/repo-nodejs.js @@ -4,8 +4,8 @@ const os = require('os') const IPFSRepo = require('ipfs-repo') const path = require('path') -module.exports = (dir) => { - const repoPath = dir || path.join(os.homedir(), '.jsipfs') +module.exports = (options) => { + const repoPath = options.repo || path.join(os.homedir(), '.jsipfs') - return new IPFSRepo(repoPath) + return new IPFSRepo(repoPath, { autoMigrate: options.repoAutoMigrate }) } diff --git a/test/cli/general.js b/test/cli/general.js index 4bff0d095d..15abf102fc 100644 --- a/test/cli/general.js +++ b/test/cli/general.js @@ -1,8 +1,17 @@ /* eslint-env mocha */ 'use strict' +const os = require('os') +const fs = require('fs').promises +const path = require('path') +const hat = require('hat') const { expect } = require('interface-ipfs-core/src/utils/mocha') +const { repoVersion } = require('ipfs-repo') +const promisify = require('promisify-es6') +const ncp = promisify(require('ncp').ncp) const runOnAndOff = require('../utils/on-and-off') +const ipfsExec = require('../utils/ipfs-exec') +const clean = require('../utils/clean') describe('general cli options', () => runOnAndOff.off((thing) => { it('should handle --silent flag', async () => { @@ -17,3 +26,83 @@ describe('general cli options', () => runOnAndOff.off((thing) => { expect(out).to.include('again') }) })) + +describe('--migrate', () => { + let ipfs, repoPath + + async function setRepoVersion (version) { + await fs.writeFile(path.join(repoPath, 'version'), version) + } + + async function getRepoVersion () { + return parseInt(await fs.readFile(path.join(repoPath, 'version'), 'utf8')) + } + + beforeEach(async () => { + repoPath = path.join(os.tmpdir(), `ipfs-${hat()}`) + const v7RepoPath = path.join(__dirname, '../fixtures/v7-repo') + await ncp(v7RepoPath, repoPath) + ipfs = ipfsExec(repoPath) + }) + + afterEach(() => clean(repoPath)) + + it('should not migrate for daemon command when --migrate flag not set', async () => { + // There are no migrations prior to 7 so it's safe to set version to 5 since + // the repo is the same. We set to 5 because version 6 & 7 are considered + // the same in repo.version.check. + await setRepoVersion(5) + const err = await ipfs.fail('daemon') + expect(err.stdout).to.include('Pass --migrate for automatic migration') + const version = await getRepoVersion() + expect(version).to.equal(5) // Should not have migrated + }) + + it('should not migrate for other commands when --migrate flag not set', async () => { + // There are no migrations prior to 7 so it's safe to set version to 5 since + // the repo is the same. We set to 5 because version 6 & 7 are considered + // the same in repo.version.check. + await setRepoVersion(5) + const err = await ipfs.fail('files ls') + expect(err.stdout).to.include('Pass --migrate for automatic migration') + const version = await getRepoVersion() + expect(version).to.equal(5) // Should not have migrated + }) + + it('should migrate for daemon command when --migrate flag set', async () => { + // There are no migrations prior to 7 so it's safe to set version to 5 since + // the repo is the same. We set to 5 because version 6 & 7 are considered + // the same in repo.version.check. + await setRepoVersion(5) + + const daemon = ipfs('daemon --migrate') + let stdout = '' + + daemon.stdout.on('data', data => { + stdout += data.toString('utf8') + + if (stdout.includes('Daemon is ready')) { + daemon.kill() + } + }) + + await expect(daemon) + .to.eventually.be.rejected() + .and.to.include({ + killed: true + }) + + const version = await getRepoVersion() + expect(version).to.equal(repoVersion) // Should have migrated to latest + }) + + it('should migrate for other commands when --migrate flag set', async () => { + // There are no migrations prior to 7 so it's safe to set version to 5 since + // the repo is the same. We set to 5 because version 6 & 7 are considered + // the same in repo.version.check. + await setRepoVersion(5) + await ipfs('files ls --migrate') + const version = await getRepoVersion() + expect(version).to.equal(repoVersion) // Should have migrated to latest + }) +}) diff --git a/test/fixtures/v7-repo/blocks/75/CIQMUSJFXRZX7ZRBICXJQPHVD7YSPD5KS75DRO7Q55ADVNORRBXV75Y.data b/test/fixtures/v7-repo/blocks/75/CIQMUSJFXRZX7ZRBICXJQPHVD7YSPD5KS75DRO7Q55ADVNORRBXV75Y.data new file mode 100644 index 0000000000..13521eaa2a Binary files /dev/null and b/test/fixtures/v7-repo/blocks/75/CIQMUSJFXRZX7ZRBICXJQPHVD7YSPD5KS75DRO7Q55ADVNORRBXV75Y.data differ diff --git a/test/fixtures/v7-repo/blocks/7J/CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data b/test/fixtures/v7-repo/blocks/7J/CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data new file mode 100644 index 0000000000..627ffcdf87 --- /dev/null +++ b/test/fixtures/v7-repo/blocks/7J/CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data @@ -0,0 +1,55 @@ + +•  + 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 + \ No newline at end of file diff --git a/test/fixtures/v7-repo/blocks/EX/CIQKA7ZA5YM6KOJE3HVPZNQ6C4TJVSVGFTWWOTHP7GWZYGDUP5HIEXY.data b/test/fixtures/v7-repo/blocks/EX/CIQKA7ZA5YM6KOJE3HVPZNQ6C4TJVSVGFTWWOTHP7GWZYGDUP5HIEXY.data new file mode 100644 index 0000000000..5321bdc1d3 --- /dev/null +++ b/test/fixtures/v7-repo/blocks/EX/CIQKA7ZA5YM6KOJE3HVPZNQ6C4TJVSVGFTWWOTHP7GWZYGDUP5HIEXY.data @@ -0,0 +1,4 @@ +/ +" ÊI%¼sæ!@®˜<õñ'ª—ú8»ðï@:µÑˆo_÷directV2 +" Ýe³ßIž\(&PD¬ + ô« 2ýhO.߃o» recursive¸V \ No newline at end of file diff --git a/test/fixtures/v7-repo/blocks/IL/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data b/test/fixtures/v7-repo/blocks/IL/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data new file mode 100644 index 0000000000..62d1c2979b --- /dev/null +++ b/test/fixtures/v7-repo/blocks/IL/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data @@ -0,0 +1,8 @@ + +Ž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 +½ \ No newline at end of file diff --git a/test/fixtures/v7-repo/blocks/K5/CIQPW4MAGTUNEBGZCEFZU7XAJL2BMIHGVB5ZR2IOKOSTRMLIKPB6K5I.data b/test/fixtures/v7-repo/blocks/K5/CIQPW4MAGTUNEBGZCEFZU7XAJL2BMIHGVB5ZR2IOKOSTRMLIKPB6K5I.data new file mode 100644 index 0000000000..e1cd3e3e21 Binary files /dev/null and b/test/fixtures/v7-repo/blocks/K5/CIQPW4MAGTUNEBGZCEFZU7XAJL2BMIHGVB5ZR2IOKOSTRMLIKPB6K5I.data differ diff --git a/test/fixtures/v7-repo/blocks/LG/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data b/test/fixtures/v7-repo/blocks/LG/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data new file mode 100644 index 0000000000..71be805f1e --- /dev/null +++ b/test/fixtures/v7-repo/blocks/LG/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data @@ -0,0 +1,9 @@ + +¿·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 +· \ No newline at end of file diff --git a/test/fixtures/v7-repo/blocks/M4/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data b/test/fixtures/v7-repo/blocks/M4/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data new file mode 100644 index 0000000000..f2bf4f8b8d --- /dev/null +++ b/test/fixtures/v7-repo/blocks/M4/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data @@ -0,0 +1,115 @@ + +½ µ # 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 + + +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 -o foo2 + diff foo foo2 + + +Objects: + + ipfs object get + ipfs object get /foo2 + ipfs object --help + + +Pin + GC: + + ipfs pin add + ipfs repo gc + ipfs ls + ipfs pin rm + ipfs repo 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/ + 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 +µ \ No newline at end of file diff --git a/test/fixtures/v7-repo/blocks/OO/CIQBT4N7PS5IZ5IG2ZOUGKFK27IE33WKGJNDW2TY3LSBNQ34R6OVOOQ.data b/test/fixtures/v7-repo/blocks/OO/CIQBT4N7PS5IZ5IG2ZOUGKFK27IE33WKGJNDW2TY3LSBNQ34R6OVOOQ.data new file mode 100644 index 0000000000..770348274e --- /dev/null +++ b/test/fixtures/v7-repo/blocks/OO/CIQBT4N7PS5IZ5IG2ZOUGKFK27IE33WKGJNDW2TY3LSBNQ34R6OVOOQ.data @@ -0,0 +1,27 @@ + +’ Š 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. + +- security@ipfs.io GPG key: + - 4B9665FB 92636D17 7C7A86D3 50AAE8A9 59B13AF3 + - https://pgp.mit.edu/pks/lookup?op=get&search=0x50AAE8A959B13AF3 + +- 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. +Š \ No newline at end of file diff --git a/test/fixtures/v7-repo/blocks/PJ/CIQB4F7VKKQDXHMXX6WYQZTRR5QVLP7VBQYAYW2Y5BAPOOGTW5H2PJQ.data b/test/fixtures/v7-repo/blocks/PJ/CIQB4F7VKKQDXHMXX6WYQZTRR5QVLP7VBQYAYW2Y5BAPOOGTW5H2PJQ.data new file mode 100644 index 0000000000..0335563629 --- /dev/null +++ b/test/fixtures/v7-repo/blocks/PJ/CIQB4F7VKKQDXHMXX6WYQZTRR5QVLP7VBQYAYW2Y5BAPOOGTW5H2PJQ.data @@ -0,0 +1,3 @@ + + Index + \ No newline at end of file diff --git a/test/fixtures/v7-repo/blocks/PU/CIQJF2E6OPOEYYEVHYML4UD5A3R4QRAVBI7NVH3PL64D3IJCWR2SPUQ.data b/test/fixtures/v7-repo/blocks/PU/CIQJF2E6OPOEYYEVHYML4UD5A3R4QRAVBI7NVH3PL64D3IJCWR2SPUQ.data new file mode 100644 index 0000000000..e6ef304bfd --- /dev/null +++ b/test/fixtures/v7-repo/blocks/PU/CIQJF2E6OPOEYYEVHYML4UD5A3R4QRAVBI7NVH3PL64D3IJCWR2SPUQ.data @@ -0,0 +1,36 @@ + +¤œ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 +œ \ No newline at end of file diff --git a/test/fixtures/v7-repo/blocks/QP/CIQNLGENZXNRUMUHZYGPPLZNZOMHHZVIU76LCD5GF5DWFPEGEKODQPI.data b/test/fixtures/v7-repo/blocks/QP/CIQNLGENZXNRUMUHZYGPPLZNZOMHHZVIU76LCD5GF5DWFPEGEKODQPI.data new file mode 100644 index 0000000000..6636930467 --- /dev/null +++ b/test/fixtures/v7-repo/blocks/QP/CIQNLGENZXNRUMUHZYGPPLZNZOMHHZVIU76LCD5GF5DWFPEGEKODQPI.data @@ -0,0 +1,4 @@ +2 +" ’èžsÜL`•>¾P}ãÈD +>ÚŸo_¸=¡"´u'Ò 0.0-intro§ + \ No newline at end of file diff --git a/test/fixtures/v7-repo/blocks/QV/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data b/test/fixtures/v7-repo/blocks/QV/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/fixtures/v7-repo/blocks/R3/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data b/test/fixtures/v7-repo/blocks/R3/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data new file mode 100644 index 0000000000..389e111776 --- /dev/null +++ b/test/fixtures/v7-repo/blocks/R3/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data @@ -0,0 +1,28 @@ + +ËÃ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 +à \ No newline at end of file diff --git a/test/fixtures/v7-repo/blocks/S2/CIQPF3CHDB5GQ5ZBISOV2GWVMLAJPVEUMDMFKJZE7CMZESO6TYFAS2I.data b/test/fixtures/v7-repo/blocks/S2/CIQPF3CHDB5GQ5ZBISOV2GWVMLAJPVEUMDMFKJZE7CMZESO6TYFAS2I.data new file mode 100644 index 0000000000..b137a86405 --- /dev/null +++ b/test/fixtures/v7-repo/blocks/S2/CIQPF3CHDB5GQ5ZBISOV2GWVMLAJPVEUMDMFKJZE7CMZESO6TYFAS2I.data @@ -0,0 +1,3 @@ +- +" õR ;—¿­ˆfqaU¿õ 0 [Xè@÷8Ó·O§¦index + \ No newline at end of file diff --git a/test/fixtures/v7-repo/blocks/SHARDING b/test/fixtures/v7-repo/blocks/SHARDING new file mode 100644 index 0000000000..a153331dac --- /dev/null +++ b/test/fixtures/v7-repo/blocks/SHARDING @@ -0,0 +1 @@ +/repo/flatfs/shard/v1/next-to-last/2 diff --git a/test/fixtures/v7-repo/blocks/WG/CIQN2ZNT35EZ4XBIEYMFARFMBIEICCIO6SVSAMQB7VUE6LW7QNX3WGQ.data b/test/fixtures/v7-repo/blocks/WG/CIQN2ZNT35EZ4XBIEYMFARFMBIEICCIO6SVSAMQB7VUE6LW7QNX3WGQ.data new file mode 100644 index 0000000000..afeac9fff9 Binary files /dev/null and b/test/fixtures/v7-repo/blocks/WG/CIQN2ZNT35EZ4XBIEYMFARFMBIEICCIO6SVSAMQB7VUE6LW7QNX3WGQ.data differ diff --git a/test/fixtures/v7-repo/blocks/X3/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data b/test/fixtures/v7-repo/blocks/X3/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data new file mode 100644 index 0000000000..9553a942db --- /dev/null +++ b/test/fixtures/v7-repo/blocks/X3/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/test/fixtures/v7-repo/blocks/_README b/test/fixtures/v7-repo/blocks/_README new file mode 100644 index 0000000000..ac3b6034c3 --- /dev/null +++ b/test/fixtures/v7-repo/blocks/_README @@ -0,0 +1,22 @@ +This is a repository of IPLD objects. Each IPLD object is in a single file, +named .data. Where is the +"base32" encoding of the CID (as specified in +https://github.com/multiformats/multibase) without the 'B' prefix. +All the object files are placed in a tree of directories, based on a +function of the CID. This is a form of sharding similar to +the objects directory in git repositories. Previously, we used +prefixes, we now use the next-to-last two charters. + func NextToLast(base32cid string) { + nextToLastLen := 2 + offset := len(base32cid) - nextToLastLen - 1 + return str[offset : offset+nextToLastLen] + } +For example, an object with a base58 CIDv1 of + zb2rhYSxw4ZjuzgCnWSt19Q94ERaeFhu9uSqRgjSdx9bsgM6f +has a base32 CIDv1 of + BAFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA +and will be placed at + SC/AFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA.data +with 'SC' being the last-to-next two characters and the 'B' at the +beginning of the CIDv1 string is the multibase prefix that is not +stored in the filename. diff --git a/test/fixtures/v7-repo/config b/test/fixtures/v7-repo/config new file mode 100644 index 0000000000..c51e36ede3 --- /dev/null +++ b/test/fixtures/v7-repo/config @@ -0,0 +1,91 @@ +{ + "Addresses": { + "Swarm": [ + "/ip4/0.0.0.0/tcp/4002", + "/ip4/127.0.0.1/tcp/4003/ws" + ], + "API": "/ip4/127.0.0.1/tcp/5002", + "Gateway": "/ip4/127.0.0.1/tcp/9090", + "Delegates": [] + }, + "Discovery": { + "MDNS": { + "Enabled": true, + "Interval": 10 + }, + "webRTCStar": { + "Enabled": true + } + }, + "Bootstrap": [ + "/ip4/104.236.176.52/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z", + "/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ", + "/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", + "/ip6/2604:a880:1:20::1f9:9001/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z", + "/ip6/2604:a880:1:20::203:d001/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM", + "/ip6/2604:a880:0:1010::23:d001/tcp/4001/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm", + "/ip6/2400:6180:0:d0::151:6001/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu", + "/ip6/2604:a880:800:10::4a:5001/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64", + "/ip6/2a03:b0c0:0:1010::23:1001/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd", + "/ip6/2a03:b0c0:1:d0::e7:1/tcp/4001/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3", + "/ip6/2604:a880:1:20::1d9:6001/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx", + "/dns4/node0.preload.ipfs.io/tcp/443/wss/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic", + "/dns4/node1.preload.ipfs.io/tcp/443/wss/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6" + ], + "Pubsub": { + "Router": "gossipsub", + "Enabled": true + }, + "Swarm": { + "ConnMgr": { + "LowWater": 200, + "HighWater": 500 + } + }, + "Identity": { + "PeerID": "Qman9VQpAckWVzY31TywMqQdzi1NsFGXXgfinYArNKFhLQ", + "PrivKey": "CAASpgkwggSiAgEAAoIBAQCwRliHPq+RkxGBuPHahayCNOu3fpPIC4B1bal8/5uMok2e0IFmcuv17fP/hxKBmPWzIE69d9gRAkAvEu3hoO8GOXdxNSFpHzP2AjaQDLSbh6DCTpWjd0TVoUjt/62RDWQ86jjiFHtzMQA/4HgCvzNFKgYpjYvtXBFr8ShTQohnMrnWAZiLXr5a0GHJMs/+6lso0tKQnU0BtrNdTJKRLkDHlzH42utSgIXpSQX/0u2s0Hz+PyuPG1RCc/OFgd0ki+x82230oBHUyBe83KgR8gGx72MDCf5A+gMFdBwY7wLd/V2R3qWY8I04t7Esg7ypft1WGO0V3mHipjSVhsR9T4HbAgMBAAECggEALywEEN1Dmo9ixfY6MqJHEekbk1U6MvRxAfvAuYSlmbLtVqyxlDr4zi1JeH4rA6dtSOxCZg2mMpcJmg9UvWaV0HKcdh0jvb/t5c2d0Fq2ElDvQlBJVx9ZulmY7KfZSNHumyaK5mVYy/C3AmENfJ6yF7YxQ/lvEqvqtZopkm5hlkvYwNckvTAAIAPuS8tT7GDwElDjwLLEoXE0onzBlziSKWE8wJjLvhMyvDNJvyNR+uC98T+sjdiDQr/ch5I+04K9Elj7BZaSbLulaSzgAvADpC9DLNHBpeFS0lR32ZE0H4ZLotwolGXWf221BgxIy8vlh97QxoY6N23+HRQocSWcEQKBgQDmbpGjEU+FG+6njyXJyHvUSYzZ9YBipNC/xZ4PtwYWHaSS+qgmkVwO4UZ5+d01/mHfncUt0bA/j0VJNWJNaQVMMpaBUr25duPzDO78Ya7Q3r5qy96MYWkq2QF+TqmDKA/3iUIUmaSendoaBQIkjeOnvezM8/GAsCoQBHeqg0I45wKBgQDD1XDeuuNThRANqqChylgKhIZuDvI2/lAZULh3Duhbrk5u+L7kxG13elyNVK4H0LllrOHWEpcPR9mEg+5OSKApg5rhRIdKKNhY0LV0ks47a114X/gOlzWiBjbaqJiAUCbdNwDiYZ11Bg/iek9PagovQ0WaLAp4qM3c4V319joM7QKBgBpkO4Xjq6nhIxpJyNgtgBE2Q02LUqL5oXb1WT8PhUDvMDQtRSj1qQeDQaEivvU6J1eHKFgxFfCRpivWU2XuS08I1DgHk/cz6LOjnZOGVJFTkZeFtf16AqOHqyYeOEfvRLTjIZBecH5CMgKc5DvvjE1f8Ukf/17vzkF7YYFD+0etAoGAeuDYu8kEjwl1Mz4XIK24ZJEXUMOsE/mrBNdzh7Eg9zX+HP+TuDPQhCGRJVU3BcxgKH48DnkHtBzfTZkC1LgZVzMu4Z6ATXYnmkMLOKRNJ1eNBNUi7vTOQGYp0TXsysaAPFohAetCQ4WUPgWE8k2VKmbJq51qzJ8O3UPEE2t2rVkCgYBRJGkcvD97HFQdtMiDFgQMVu0NCkgNJQmYE9t8ZBfuY9MJuA/ZPJnoj/JCVgoP+MkqhFsLcujgj6K0hT80wvfXrWI+zZHJII1PHhq/cbIAwMu5geXw4mlsE3GR+euBj8x3vmIFwBVoo3U1Ig3A5Y59ymXK+diNGvvAsPhPvm7lEw==" + }, + "datastore": { + "Spec": { + "type": "mount", + "mounts": [ + { + "mountpoint": "/blocks", + "type": "measure", + "prefix": "flatfs.datastore", + "child": { + "type": "flatfs", + "path": "blocks", + "sync": true, + "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2" + } + }, + { + "mountpoint": "/", + "type": "measure", + "prefix": "leveldb.datastore", + "child": { + "type": "levelds", + "path": "datastore", + "compression": "none" + } + } + ] + } + }, + "Keychain": { + "dek": { + "keyLength": 64, + "iterationCount": 10000, + "salt": "fwvY3+pFurDT/4YrT17AcHDD", + "hash": "sha2-512" + } + } +} \ No newline at end of file diff --git a/test/fixtures/v7-repo/datastore/000005.ldb b/test/fixtures/v7-repo/datastore/000005.ldb new file mode 100644 index 0000000000..1779718894 Binary files /dev/null and b/test/fixtures/v7-repo/datastore/000005.ldb differ diff --git a/test/fixtures/v7-repo/datastore/CURRENT b/test/fixtures/v7-repo/datastore/CURRENT new file mode 100644 index 0000000000..6ba31a31e7 --- /dev/null +++ b/test/fixtures/v7-repo/datastore/CURRENT @@ -0,0 +1 @@ +MANIFEST-000009 diff --git a/test/fixtures/v7-repo/datastore/LOCK b/test/fixtures/v7-repo/datastore/LOCK new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/fixtures/v7-repo/datastore/LOG b/test/fixtures/v7-repo/datastore/LOG new file mode 100644 index 0000000000..3956eda492 --- /dev/null +++ b/test/fixtures/v7-repo/datastore/LOG @@ -0,0 +1,3 @@ +2019/11/08-11:17:58.563302 7000129b5000 Recovering log #8 +2019/11/08-11:17:58.564492 7000129b5000 Delete type=3 #7 +2019/11/08-11:17:58.564569 7000129b5000 Delete type=0 #8 diff --git a/test/fixtures/v7-repo/datastore/LOG.old b/test/fixtures/v7-repo/datastore/LOG.old new file mode 100644 index 0000000000..dd4568070a --- /dev/null +++ b/test/fixtures/v7-repo/datastore/LOG.old @@ -0,0 +1,3 @@ +2019/11/08-11:17:58.524712 70000be54000 Recovering log #6 +2019/11/08-11:17:58.540338 70000be54000 Delete type=0 #6 +2019/11/08-11:17:58.540580 70000be54000 Delete type=3 #4 diff --git a/test/fixtures/v7-repo/datastore/MANIFEST-000009 b/test/fixtures/v7-repo/datastore/MANIFEST-000009 new file mode 100644 index 0000000000..def4b8d1c5 Binary files /dev/null and b/test/fixtures/v7-repo/datastore/MANIFEST-000009 differ diff --git a/test/fixtures/v7-repo/datastore_spec b/test/fixtures/v7-repo/datastore_spec new file mode 100644 index 0000000000..7bf9626c24 --- /dev/null +++ b/test/fixtures/v7-repo/datastore_spec @@ -0,0 +1 @@ +{"mounts":[{"mountpoint":"/blocks","path":"blocks","shardFunc":"/repo/flatfs/shard/v1/next-to-last/2","type":"flatfs"},{"mountpoint":"/","path":"datastore","type":"levelds"}],"type":"mount"} \ No newline at end of file diff --git a/test/fixtures/v7-repo/version b/test/fixtures/v7-repo/version new file mode 100644 index 0000000000..c7930257df --- /dev/null +++ b/test/fixtures/v7-repo/version @@ -0,0 +1 @@ +7 \ No newline at end of file