# go-dms3 ![banner](https://dms3.io/dms3/QmVk7srrwahXLNmcDYvyUEJptyoxpndnRa57YJ11L4jV26/dms3.go.png) [![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) [![Matrix](https://img.shields.io/badge/matrix-%23dms3%3Amatrix.org-blue.svg?style=flat-square)](https://matrix.to/#/room/#dms3:matrix.org) [![IRC](https://img.shields.io/badge/freenode-%23dms3-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23dms3) [![Discord](https://img.shields.io/discord/475789330380488707?color=blueviolet&label=discord&style=flat-square)](https://discord.gg/24fmuwR) [![GoDoc](https://img.shields.io/badge/godoc-reference-5272B4.svg?style=flat-square)](https://godoc.org/gitlab.dms3.io/dms3/public/go-dms3) [![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) [![CircleCI](https://img.shields.io/circleci/build/github/dms3/go-dms3?style=flat-square)](https://circleci.com/gh/dms3/go-dms3) ## What is DMS3? DMS3 is a global, versioned, peer-to-peer filesystem. It combines good ideas from previous systems such as Git, BitTorrent, Kademlia, SFS, and the Web. It is like a single BitTorrent swarm, exchanging git objects. DMS3 provides an interface as simple as the HTTP web, but with permanence built-in. You can also mount the world at /dms3. For more info see: https://docs.dms3.io/introduction/overview/ Before opening an issue, consider using one of the following locations to ensure you are opening your thread in the right place: - go-dms3 _implementation_ bugs in [this repo](https://gitlab.dms3.io/dms3/public/go-dms3/issues). - Documentation issues in [dms3/docs issues](https://gitlab.dms3.io/dms3/public/docs/issues). - DMS3 _design_ in [dms3/specs issues](https://gitlab.dms3.io/dms3/public/specs/issues). - Exploration of new ideas in [dms3/notes issues](https://gitlab.dms3.io/dms3/public/notes/issues). - Ask questions and meet the rest of the community at the [DMS3 Forum](https://discuss.dms3.io). ## Table of Contents - [Security Issues](#security-issues) - [Install](#install) - [System Requirements](#system-requirements) - [Install prebuilt packages](#install-prebuilt-packages) - [From Linux package managers](#from-linux-package-managers) - [Build from Source](#build-from-source) - [Install Go](#install-go) - [Download and Compile DMS3](#download-and-compile-dms3) - [Troubleshooting](#troubleshooting) - [Updating go-dms3](#updating-go-dms3) - [Getting Started](#getting-started) - [Some things to try](#some-things-to-try) - [Usage](#usage) - [Running DMS3 inside Docker](#running-dms3-inside-docker) - [Troubleshooting](#troubleshooting-1) - [Packages](#packages) - [Development](#development) - [CLI, HTTP-API, Architecture Diagram](#cli-http-api-architecture-diagram) - [Testing](#testing) - [Development Dependencies](#development-dependencies) - [Contributing](#contributing) - [License](#license) ## Security Issues The DMS3 protocol and its implementations are still in heavy development. This means that there may be problems in our protocols, or there may be mistakes in our implementations. And -- though DMS3 is not production-ready yet -- many people are already running nodes in their machines. So we take security vulnerabilities very seriously. If you discover a security issue, please bring it to our attention right away! If you find a vulnerability that may affect live deployments -- for example, by exposing a remote execution exploit -- please send your report privately to security@dms3.io. Please DO NOT file a public issue. If the issue is a protocol weakness that cannot be immediately exploited or something not yet deployed, just discuss it openly. ## Install The canonical download instructions for DMS3 are over at: https://docs.dms3.io/guides/guides/install/. It is **highly recommended** you follow those instructions if you are not interested in working on DMS3 development. ### System Requirements DMS3 can run on most Linux, macOS, and Windows systems. We recommend running it on a machine with at least 2 GB of RAM and 2 CPU cores (go-dms3 is highly parallel). On systems with less memory, it may not be completely stable. If your system is resource-constrained, we recommend: 1. Installing OpenSSL and rebuilding go-dms3 manually with `make build GOTAGS=openssl`. See the [download and compile](#download-and-compile-dms3) section for more information on compiling go-dms3. 2. Initializing your daemon with `dms3 init --profile=lowpower` ### Install prebuilt packages We host prebuilt binaries over at our [distributions page](https://dms3.io/dms3ns/dist.dms3.io#go-dms3). From there: - Click the blue "Download go-dms3" on the right side of the page. - Open/extract the archive. - Move `dms3` to your path (`install.sh` can do it for you). You can also download go-dms3 from this project's GitHub releases page if you are unable to access dms3.io. ### From Linux package managers - [Arch Linux](#arch-linux) - [Nix](#nix) - [Solus](#solus) - [Snap](#snap) #### Arch Linux In Arch Linux go-dms3 is available as [go-dms3](https://www.archlinux.org/packages/community/x86_64/go-dms3/) package. ``` $ sudo pacman -S go-dms3 ``` Development version of go-dms3 is also on AUR under [go-dms3-git](https://aur.archlinux.org/packages/go-dms3-git/). You can install it using your favorite AUR Helper or manually from AUR. #### Nix For Linux and MacOSX you can use the purely functional package manager [Nix](https://nixos.org/nix/): ``` $ nix-env -i dms3 ``` You can also install the Package by using its attribute name, which is also `dms3`. #### Guix GNU's functional package manager, [Guix](https://www.gnu.org/software/guix/), also provides a go-dms3 package: ``` $ guix package -i go-dms3 ``` #### Solus In solus, go-dms3 is available in the main repository as [go-dms3](https://dev.getsol.us/source/go-dms3/repository/master/). ``` $ sudo eopkg install go-dms3 ``` You can also install it through the Solus software center. #### Snap With snap, in any of the [supported Linux distributions](https://snapcraft.io/docs/core/install): ``` $ sudo snap install dms3 ``` ### From Windows package managers - [Chocolatey](#chocolatey) - [Scoop](#scoop) #### Chocolatey The package [dms3](https://chocolatey.org/packages/dms3) currently points to go-dms3 and is being maintained. ```Powershell PS> choco install dms3 ``` #### Scoop Scoop provides `go-dms3` in its 'extras' bucket. ```Powershell PS> scoop bucket add extras PS> scoop install go-dms3 ``` ### Build from Source go-dms3's build system requires Go 1.14.4 and some standard POSIX build tools: * GNU make * Git * GCC (or some other go compatible C Compiler) (optional) To build without GCC, build with `CGO_ENABLED=0` (e.g., `make build CGO_ENABLED=0`). #### Install Go The build process for dms3 requires Go 1.14.4 or higher. If you don't have it: [Download Go 1.14+](https://golang.org/dl/). You'll need to add Go's bin directories to your `$PATH` environment variable e.g., by adding these lines to your `/etc/profile` (for a system-wide installation) or `$HOME/.profile`: ``` export PATH=$PATH:/usr/local/go/bin export PATH=$PATH:$GOPATH/bin ``` (If you run into trouble, see the [Go install instructions](https://golang.org/doc/install)). #### Download and Compile DMS3 ``` $ git clone https://gitlab.dms3.io/dms3/public/go-dms3.git $ cd go-dms3 $ make install ``` Alternatively, you can run `make build` to build the go-dms3 binary (storing it in `cmd/dms3/dms3`) without installing it. **NOTE:** If you get an error along the lines of "fatal error: stdlib.h: No such file or directory", you're missing a C compiler. Either re-run `make` with `CGO_ENABLED=0` or install GCC. ##### Cross Compiling Compiling for a different platform is as simple as running: ``` make build GOOS=myTargetOS GOARCH=myTargetArchitecture ``` ##### OpenSSL To build go-dms3 with OpenSSL support, append `GOTAGS=openssl` to your `make` invocation. Building with OpenSSL should significantly reduce the background CPU usage on nodes that frequently make or receive new connections. Note: OpenSSL requires CGO support and, by default, CGO is disabled when cross-compiling. To cross-compile with OpenSSL support, you must: 1. Install a compiler toolchain for the target platform. 2. Set the `CGO_ENABLED=1` environment variable. #### Troubleshooting - Separate [instructions are available for building on Windows](docs/windows.md). - `git` is required in order for `go get` to fetch all dependencies. - Package managers often contain out-of-date `golang` packages. Ensure that `go version` reports at least 1.10. See above for how to install go. - If you are interested in development, please install the development dependencies as well. - _WARNING_: Older versions of OSX FUSE (for Mac OS X) can cause kernel panics when mounting!- We strongly recommend you use the [latest version of OSX FUSE](http://osxfuse.github.io/). (See https://gitlab.dms3.io/dms3/public/go-dms3/issues/177) - For more details on setting up FUSE (so that you can mount the filesystem), see the docs folder. - Shell command completion is available in `misc/completion/dms3-completion.bash`. Read [docs/command-completion.md](docs/command-completion.md) to learn how to install it. - See the [misc folder](https://gitlab.dms3.io/dms3/public/go-dms3/tree/master/misc) for how to connect DMS3 to systemd or whatever init system your distro uses. ### Updating go-dms3 #### Using dms3-update DMS3 has an updating tool that can be accessed through `dms3 update`. The tool is not installed alongside DMS3 in order to keep that logic independent of the main codebase. To install `dms3 update`, [download it here](https://dms3.io/dms3ns/dist.dms3.io/#dms3-update). #### Downloading DMS3 builds using DMS3 List the available versions of go-dms3: ``` $ dms3 cat /dms3ns/dist.dms3.io/go-dms3/versions ``` Then, to view available builds for a version from the previous command ($VERSION): ``` $ dms3 ls /dms3ns/dist.dms3.io/go-dms3/$VERSION ``` To download a given build of a version: ``` $ dms3 get /dms3ns/dist.dms3.io/go-dms3/$VERSION/go-dms3_$VERSION_darwin-386.tar.gz # darwin 32-bit build $ dms3 get /dms3ns/dist.dms3.io/go-dms3/$VERSION/go-dms3_$VERSION_darwin-amd64.tar.gz # darwin 64-bit build $ dms3 get /dms3ns/dist.dms3.io/go-dms3/$VERSION/go-dms3_$VERSION_freebsd-amd64.tar.gz # freebsd 64-bit build $ dms3 get /dms3ns/dist.dms3.io/go-dms3/$VERSION/go-dms3_$VERSION_linux-386.tar.gz # linux 32-bit build $ dms3 get /dms3ns/dist.dms3.io/go-dms3/$VERSION/go-dms3_$VERSION_linux-amd64.tar.gz # linux 64-bit build $ dms3 get /dms3ns/dist.dms3.io/go-dms3/$VERSION/go-dms3_$VERSION_linux-arm.tar.gz # linux arm build $ dms3 get /dms3ns/dist.dms3.io/go-dms3/$VERSION/go-dms3_$VERSION_windows-amd64.zip # windows 64-bit build ``` ## Getting Started See also: https://docs.dms3.io/introduction/usage/ To start using DMS3, you must first initialize DMS3's config files on your system, this is done with `dms3 init`. See `dms3 init --help` for information on the optional arguments it takes. After initialization is complete, you can use `dms3 mount`, `dms3 add` and any of the other commands to explore! ### Some things to try Basic proof of 'dms3 working' locally: echo "hello world" > hello dms3 add hello # This should output a hash string that looks something like: # QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o dms3 cat ### Usage ``` dms3 - Global p2p merkle-dag filesystem. dms3 [] [] ... SUBCOMMANDS BASIC COMMANDS init Initialize dms3 local configuration add Add a file to dms3 cat Show dms3 object data get Download dms3 objects ls List links from an object refs List hashes of links from an object DATA STRUCTURE COMMANDS block Interact with raw blocks in the datastore object Interact with raw dag nodes files Interact with objects as if they were a unix filesystem ADVANCED COMMANDS daemon Start a long-running daemon process mount Mount an dms3 read-only mount point resolve Resolve any type of name name Publish or resolve DMS3NS names dns Resolve DNS links pin Pin objects to local storage repo Manipulate an DMS3 repository NETWORK COMMANDS id Show info about dms3 peers bootstrap Add or remove bootstrap peers swarm Manage connections to the p2p network dht Query the DHT for values or peers ping Measure the latency of a connection diag Print diagnostics TOOL COMMANDS config Manage configuration version Show dms3 version information update Download and apply go-dms3 updates commands List all available commands Use 'dms3 --help' to learn more about each command. dms3 uses a repository in the local file system. By default, the repo is located at ~/.dms3. To change the repo location, set the $DMS3_PATH environment variable: export DMS3_PATH=/path/to/dms3repo ``` ### Running DMS3 inside Docker An DMS3 docker image is hosted at [hub.docker.com/r/dms3/go-dms3](https://hub.docker.com/r/dms3/go-dms3/). To make files visible inside the container you need to mount a host directory with the `-v` option to docker. Choose a directory that you want to use to import/export files from DMS3. You should also choose a directory to store DMS3 files that will persist when you restart the container. export dms3_staging= export dms3_data= Start a container running dms3 and expose ports 4001, 5001 and 8080: docker run -d --name dms3_host -v $dms3_staging:/export -v $dms3_data:/data/dms3 -p 4001:4001 -p 4001:4001/udp -p 127.0.0.1:8080:8080 -p 127.0.0.1:5001:5001 dms3/go-dms3:latest Watch the dms3 log: docker logs -f dms3_host Wait for dms3 to start. dms3 is running when you see: Gateway (readonly) server listening on /ip4/0.0.0.0/tcp/8080 You can now stop watching the log. Run dms3 commands: docker exec dms3_host dms3 For example: connect to peers docker exec dms3_host dms3 swarm peers Add files: cp -r $dms3_staging docker exec dms3_host dms3 add -r /export/ Stop the running container: docker stop dms3_host When starting a container running dms3 for the first time with an empty data directory, it will call `dms3 init` to initialize configuration files and generate a new keypair. At this time, you can choose which profile to apply using the `DMS3_PROFILE` environment variable: docker run -d --name dms3_host -e DMS3_PROFILE=server -v $dms3_staging:/export -v $dms3_data:/data/dms3 -p 4001:4001 -p 4001:4001/udp -p 127.0.0.1:8080:8080 -p 127.0.0.1:5001:5001 dms3/go-dms3:latest #### Private swarms inside Docker It is possible to initialize the container with a swarm key file (`/data/dms3/swarm.key`) using the variables `DMS3_SWARM_KEY` and `DMS3_SWARM_KEY_FILE`. The `DMS3_SWARM_KEY` creates `swarm.key` with the contents of the variable itself, whilst `DMS3_SWARM_KEY_FILE` copies the key from a path stored in the variable. The `DMS3_SWARM_KEY_FILE` **overwrites** the key generated by `DMS3_SWARM_KEY`. docker run -d --name dms3_host -e DMS3_SWARM_KEY= -v $dms3_staging:/export -v $dms3_data:/data/dms3 -p 4001:4001 -p 4001:4001/udp -p 127.0.0.1:8080:8080 -p 127.0.0.1:5001:5001 dms3/go-dms3:latest The swarm key initialization can also be done using docker secrets **(requires docker swarm or docker-compose)**: cat your_swarm.key | docker secret create swarm_key_secret - docker run -d --name dms3_host --secret swarm_key_secret -e DMS3_SWARM_KEY_FILE=/run/secrets/swarm_key_secret -v $dms3_staging:/export -v $dms3_data:/data/dms3 -p 4001:4001 -p 4001:4001/udp -p 127.0.0.1:8080:8080 -p 127.0.0.1:5001:5001 dms3/go-dms3:latest #### Key rotation inside Docker If needed, it is possible to do key rotation in an ephemeral container that is temporarily executing against a volume that is mounted under `/data/dms3`: ```sh # given container named 'dms3-test' that persists repo at /path/to/persisted/.dms3 $ docker run -d --name dms3-test -v /path/to/persisted/.dms3:/data/dms3 dms3/go-dms3:v0.7.0 $ docker stop dms3-test # key rotation works like this (old key saved under 'old-self') $ docker run --rm -it -v /path/to/persisted/.dms3:/data/dms3 dms3/go-dms3:v0.7.0 key rotate -o old-self -t ed25519 $ docker start dms3-test # will start with the new key ``` ### Troubleshooting If you have previously installed DMS3 before and you are running into problems getting a newer version to work, try deleting (or backing up somewhere else) your DMS3 config directory (~/.dms3 by default) and rerunning `dms3 init`. This will reinitialize the config file to its defaults and clear out the local datastore of any bad entries. Please direct general questions and help requests to our [forum](https://discuss.dms3.io) or our IRC channel (freenode #dms3). If you believe you've found a bug, check the [issues list](https://gitlab.dms3.io/dms3/public/go-dms3/issues) and, if you don't see your problem there, either come talk to us on IRC (freenode #dms3) or file an issue of your own! ## Packages > This table is generated using the module [`package-table`](https://gitlab.dms3.io/dms3/public-shipyard/package-table) with `package-table --data=package-list.json`. Listing of the main packages used in the DMS3 ecosystem. There are also three specifications worth linking here: | Name | CI/Travis | Coverage | Description | | ---------|---------|---------|--------- | | **Libp2p** | | [`go-libp2p`](//gitlab.dms3.io/dms3/public/libp2p/go-libp2p) | [![Travis CI](https://flat.badgen.net/travis/libp2p/go-libp2p/master)](https://travis-ci.com/libp2p/go-libp2p) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/go-libp2p) | p2p networking library | | [`go-libp2p-pubsub`](//gitlab.dms3.io/dms3/public/libp2p/go-libp2p-pubsub) | [![Travis CI](https://flat.badgen.net/travis/libp2p/go-libp2p-pubsub/master)](https://travis-ci.com/libp2p/go-libp2p-pubsub) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-pubsub/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/go-libp2p-pubsub) | pubsub built on libp2p | | [`go-libp2p-kad-dht`](//gitlab.dms3.io/dms3/public/libp2p/go-libp2p-kad-dht) | [![Travis CI](https://flat.badgen.net/travis/libp2p/go-libp2p-kad-dht/master)](https://travis-ci.com/libp2p/go-libp2p-kad-dht) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-kad-dht/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/go-libp2p-kad-dht) | dht-backed router | | [`go-libp2p-pubsub-router`](//gitlab.dms3.io/dms3/public/libp2p/go-libp2p-pubsub-router) | [![Travis CI](https://flat.badgen.net/travis/libp2p/go-libp2p-pubsub-router/master)](https://travis-ci.com/libp2p/go-libp2p-pubsub-router) | [![codecov](https://codecov.io/gh/libp2p/go-libp2p-pubsub-router/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/go-libp2p-pubsub-router) | pubsub-backed router | | **Multiformats** | | [`go-cid`](//gitlab.dms3.io/dms3/public/go-cid) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-cid/master)](https://travis-ci.com/dms3/go-cid) | [![codecov](https://codecov.io/gh/dms3/go-cid/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-cid) | CID implementation | | [`go-multiaddr`](//gitlab.dms3.io/dms3/public/multiformats) | [![Travis CI](https://flat.badgen.net/travis/multiformats/go-multiaddr/master)](https://travis-ci.com/multiformats/go-multiaddr) | [![codecov](https://codecov.io/gh/multiformats/go-multiaddr/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/multiformats/go-multiaddr) | multiaddr implementation | | [`go-multihash`](//github.com/multiformats/go-multihash) | [![Travis CI](https://flat.badgen.net/travis/multiformats/go-multihash/master)](https://travis-ci.com/multiformats/go-multihash) | [![codecov](https://codecov.io/gh/multiformats/go-multihash/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/multiformats/go-multihash) | multihash implementation | | [`go-multibase`](//github.com/multiformats/go-multibase) | [![Travis CI](https://flat.badgen.net/travis/multiformats/go-multibase/master)](https://travis-ci.com/multiformats/go-multibase) | [![codecov](https://codecov.io/gh/multiformats/go-multibase/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/multiformats/go-multibase) | mulitbase implementation | | **Files** | | [`go-unixfs`](//gitlab.dms3.io/dms3/public/go-unixfs) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-unixfs/master)](https://travis-ci.com/dms3/go-unixfs) | [![codecov](https://codecov.io/gh/dms3/go-unixfs/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-unixfs) | the core 'filesystem' logic | | [`go-mfs`](//gitlab.dms3.io/dms3/public/go-mfs) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-mfs/master)](https://travis-ci.com/dms3/go-mfs) | [![codecov](https://codecov.io/gh/dms3/go-mfs/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-mfs) | a mutable filesystem editor for unixfs | | [`go-dms3-posinfo`](//gitlab.dms3.io/dms3/public/go-dms3-posinfo) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-dms3-posinfo/master)](https://travis-ci.com/dms3/go-dms3-posinfo) | [![codecov](https://codecov.io/gh/dms3/go-dms3-posinfo/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-dms3-posinfo) | helper datatypes for the filestore | | [`go-dms3-chunker`](//gitlab.dms3.io/dms3/public/go-dms3-chunker) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-dms3-chunker/master)](https://travis-ci.com/dms3/go-dms3-chunker) | [![codecov](https://codecov.io/gh/dms3/go-dms3-chunker/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-dms3-chunker) | file chunkers | | **Exchange** | | [`go-dms3-exchange-interface`](//gitlab.dms3.io/dms3/public/go-dms3-exchange-interface) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-dms3-exchange-interface/master)](https://travis-ci.com/dms3/go-dms3-exchange-interface) | [![codecov](https://codecov.io/gh/dms3/go-dms3-exchange-interface/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-dms3-exchange-interface) | exchange service interface | | [`go-dms3-exchange-offline`](//gitlab.dms3.io/dms3/public/go-dms3-exchange-offline) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-dms3-exchange-offline/master)](https://travis-ci.com/dms3/go-dms3-exchange-offline) | [![codecov](https://codecov.io/gh/dms3/go-dms3-exchange-offline/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-dms3-exchange-offline) | (dummy) offline implementation of the exchange service | | [`go-bitswap`](//gitlab.dms3.io/dms3/public/go-bitswap) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-bitswap/master)](https://travis-ci.com/dms3/go-bitswap) | [![codecov](https://codecov.io/gh/dms3/go-bitswap/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-bitswap) | bitswap protocol implementation | | [`go-blockservice`](//gitlab.dms3.io/dms3/public/go-blockservice) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-blockservice/master)](https://travis-ci.com/dms3/go-blockservice) | [![codecov](https://codecov.io/gh/dms3/go-blockservice/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-blockservice) | service that plugs a blockstore and an exchange together | | **Datastores** | | [`go-datastore`](//gitlab.dms3.io/dms3/public/go-datastore) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-datastore/master)](https://travis-ci.com/dms3/go-datastore) | [![codecov](https://codecov.io/gh/dms3/go-datastore/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-datastore) | datastore interfaces, adapters, and basic implementations | | [`go-dms3-ds-help`](//gitlab.dms3.io/dms3/public/go-dms3-ds-help) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-dms3-ds-help/master)](https://travis-ci.com/dms3/go-dms3-ds-help) | [![codecov](https://codecov.io/gh/dms3/go-dms3-ds-help/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-dms3-ds-help) | datastore utility functions | | [`go-ds-flatfs`](//gitlab.dms3.io/dms3/public/go-ds-flatfs) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-ds-flatfs/master)](https://travis-ci.com/dms3/go-ds-flatfs) | [![codecov](https://codecov.io/gh/dms3/go-ds-flatfs/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-ds-flatfs) | a filesystem-based datastore | | [`go-ds-measure`](//gitlab.dms3.io/dms3/public/go-ds-measure) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-ds-measure/master)](https://travis-ci.com/dms3/go-ds-measure) | [![codecov](https://codecov.io/gh/dms3/go-ds-measure/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-ds-measure) | a metric-collecting database adapter | | [`go-ds-leveldb`](//gitlab.dms3.io/dms3/public/go-ds-leveldb) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-ds-leveldb/master)](https://travis-ci.com/dms3/go-ds-leveldb) | [![codecov](https://codecov.io/gh/dms3/go-ds-leveldb/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-ds-leveldb) | a leveldb based datastore | | [`go-ds-badger`](//gitlab.dms3.io/dms3/public/go-ds-badger) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-ds-badger/master)](https://travis-ci.com/dms3/go-ds-badger) | [![codecov](https://codecov.io/gh/dms3/go-ds-badger/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-ds-badger) | a badgerdb based datastore | | **Namesys** | | [`go-dms3ns`](//gitlab.dms3.io/dms3/public/go-dms3ns) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-dms3ns/master)](https://travis-ci.com/dms3/go-dms3ns) | [![codecov](https://codecov.io/gh/dms3/go-dms3ns/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-dms3ns) | DMS3NS datastructures and validation logic | | **Repo** | | [`go-dms3-config`](//gitlab.dms3.io/dms3/public/go-dms3-config) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-dms3-config/master)](https://travis-ci.com/dms3/go-dms3-config) | [![codecov](https://codecov.io/gh/dms3/go-dms3-config/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-dms3-config) | go-dms3 config file definitions | | [`go-fs-lock`](//gitlab.dms3.io/dms3/public/go-fs-lock) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-fs-lock/master)](https://travis-ci.com/dms3/go-fs-lock) | [![codecov](https://codecov.io/gh/dms3/go-fs-lock/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-fs-lock) | lockfile management functions | | [`fs-repo-migrations`](//gitlab.dms3.io/dms3/public/fs-repo-migrations) | [![Travis CI](https://flat.badgen.net/travis/dms3/fs-repo-migrations/master)](https://travis-ci.com/dms3/fs-repo-migrations) | [![codecov](https://codecov.io/gh/dms3/fs-repo-migrations/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/fs-repo-migrations) | repo migrations | | **DMS3LD** | | [`go-block-format`](//gitlab.dms3.io/dms3/public/go-block-format) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-block-format/master)](https://travis-ci.com/dms3/go-block-format) | [![codecov](https://codecov.io/gh/dms3/go-block-format/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-block-format) | block interfaces and implementations | | [`go-dms3-blockstore`](//gitlab.dms3.io/dms3/public/go-dms3-blockstore) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-dms3-blockstore/master)](https://travis-ci.com/dms3/go-dms3-blockstore) | [![codecov](https://codecov.io/gh/dms3/go-dms3-blockstore/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-dms3-blockstore) | blockstore interfaces and implementations | | [`go-dms3ld-format`](//gitlab.dms3.io/dms3/public/go-dms3ld-format) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-dms3ld-format/master)](https://travis-ci.com/dms3/go-dms3ld-format) | [![codecov](https://codecov.io/gh/dms3/go-dms3ld-format/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-dms3ld-format) | DMS3LD interfaces | | [`go-dms3ld-cbor`](//gitlab.dms3.io/dms3/public/go-dms3ld-cbor) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-dms3ld-cbor/master)](https://travis-ci.com/dms3/go-dms3ld-cbor) | [![codecov](https://codecov.io/gh/dms3/go-dms3ld-cbor/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-dms3ld-cbor) | DMS3LD-CBOR implementation | | [`go-dms3ld-git`](//gitlab.dms3.io/dms3/public/go-dms3ld-git) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-dms3ld-git/master)](https://travis-ci.com/dms3/go-dms3ld-git) | [![codecov](https://codecov.io/gh/dms3/go-dms3ld-git/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-dms3ld-git) | DMS3LD-Git implementation | | [`go-merkledag`](//gitlab.dms3.io/dms3/public/go-merkledag) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-merkledag/master)](https://travis-ci.com/dms3/go-merkledag) | [![codecov](https://codecov.io/gh/dms3/go-merkledag/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-merkledag) | DMS3LD-Merkledag implementation (and then some) | | **Commands** | | [`go-dms3-cmds`](//gitlab.dms3.io/dms3/public/go-dms3-cmds) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-dms3-cmds/master)](https://travis-ci.com/dms3/go-dms3-cmds) | [![codecov](https://codecov.io/gh/dms3/go-dms3-cmds/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-dms3-cmds) | CLI & HTTP commands library | | [`go-dms3-files`](//gitlab.dms3.io/dms3/public/go-dms3-files) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-dms3-files/master)](https://travis-ci.com/dms3/go-dms3-files) | [![codecov](https://codecov.io/gh/dms3/go-dms3-files/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-dms3-files) | CLI & HTTP commands library | | [`go-dms3-api`](//gitlab.dms3.io/dms3/public/go-dms3-api) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-dms3-api/master)](https://travis-ci.com/dms3/go-dms3-api) | [![codecov](https://codecov.io/gh/dms3/go-dms3-api/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-dms3-api) | an old, stable shell for the DMS3 HTTP API | | [`go-dms3-http-client`](//gitlab.dms3.io/dms3/public/go-dms3-http-client) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-dms3-http-client/master)](https://travis-ci.com/dms3/go-dms3-http-client) | [![codecov](https://codecov.io/gh/dms3/go-dms3-http-client/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-dms3-http-client) | a new, unstable shell for the DMS3 HTTP API | | [`interface-go-dms3-core`](//gitlab.dms3.io/dms3/public/interface-go-dms3-core) | [![Travis CI](https://flat.badgen.net/travis/dms3/interface-go-dms3-core/master)](https://travis-ci.com/dms3/interface-go-dms3-core) | [![codecov](https://codecov.io/gh/dms3/interface-go-dms3-core/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/interface-go-dms3-core) | core go-dms3 API interface definitions | | **Metrics & Logging** | | [`go-metrics-interface`](//gitlab.dms3.io/dms3/public/go-metrics-interface) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-metrics-interface/master)](https://travis-ci.com/dms3/go-metrics-interface) | [![codecov](https://codecov.io/gh/dms3/go-metrics-interface/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-metrics-interface) | metrics collection interfaces | | [`go-metrics-prometheus`](//gitlab.dms3.io/dms3/public/go-metrics-prometheus) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-metrics-prometheus/master)](https://travis-ci.com/dms3/go-metrics-prometheus) | [![codecov](https://codecov.io/gh/dms3/go-metrics-prometheus/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-metrics-prometheus) | prometheus-backed metrics collector | | [`go-log`](//gitlab.dms3.io/dms3/public/go-log) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-log/master)](https://travis-ci.com/dms3/go-log) | [![codecov](https://codecov.io/gh/dms3/go-log/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-log) | logging framework | | **Generics/Utils** | | [`go-dms3-routing`](//gitlab.dms3.io/dms3/public/go-dms3-routing) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-dms3-routing/master)](https://travis-ci.com/dms3/go-dms3-routing) | [![codecov](https://codecov.io/gh/dms3/go-dms3-routing/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-dms3-routing) | routing (content, peer, value) helpers | | [`go-dms3-util`](//gitlab.dms3.io/dms3/public/go-dms3-util) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-dms3-util/master)](https://travis-ci.com/dms3/go-dms3-util) | [![codecov](https://codecov.io/gh/dms3/go-dms3-util/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-dms3-util) | the kitchen sink | | [`go-dms3-addr`](//gitlab.dms3.io/dms3/public/go-dms3-addr) | [![Travis CI](https://flat.badgen.net/travis/dms3/go-dms3-addr/master)](https://travis-ci.com/dms3/go-dms3-addr) | [![codecov](https://codecov.io/gh/dms3/go-dms3-addr/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/dms3/go-dms3-addr) | utility functions for parsing DMS3 multiaddrs | For brevity, we've omitted most go-libp2p, go-dms3ld, and go-multiformats packages. These package tables can be found in their respective project's READMEs: * [go-libp2p](https://gitlab.dms3.io/dms3/public/libp2p/go-libp2p#packages) * [go-dms3ld](https://gitlab.dms3.io/dms3/public/dms3ld/go-dms3ld#packages) ## Development Some places to get you started on the codebase: - Main file: [./cmd/dms3/main.go](https://gitlab.dms3.io/dms3/public/go-dms3/blob/master/cmd/dms3/main.go) - CLI Commands: [./core/commands/](https://gitlab.dms3.io/dms3/public/go-dms3/tree/master/core/commands) - Bitswap (the data trading engine): [go-bitswap](https://gitlab.dms3.io/dms3/public/go-bitswap) - libp2p - libp2p: https://gitlab.dms3.io/dms3/public/libp2p/go-libp2p - DHT: https://gitlab.dms3.io/dms3/public/libp2p/go-libp2p-kad-dht - PubSub: https://gitlab.dms3.io/dms3/public/libp2p/go-libp2p-pubsub - [DMS3 : The `Add` command demystified](https://gitlab.dms3.io/dms3/public/go-dms3/tree/master/docs/add-code-flow.md) ### Map of go-dms3 Subsystems **WIP**: This is a high-level architecture diagram of the various sub-systems of go-dms3. To be updated with how they interact. Anyone who has suggestions is welcome to comment [here](https://docs.google.com/drawings/d/1OVpBT2q-NtSJqlPX3buvjYhOnWfdzb85YEsM_njesME/edit) on how we can improve this! ### CLI, HTTP-API, Architecture Diagram ![](./docs/cli-http-api-core-diagram.png) > [Origin](https://gitlab.dms3.io/dms3/public/pm/pull/678#discussion_r210410924) Description: Dotted means "likely going away". The "Legacy" parts are thin wrappers around some commands to translate between the new system and the old system. The grayed-out parts on the "daemon" diagram are there to show that the code is all the same, it's just that we turn some pieces on and some pieces off depending on whether we're running on the client or the server. ### Testing ``` make test ``` ### Development Dependencies If you make changes to the protocol buffers, you will need to install the [protoc compiler](https://github.com/google/protobuf). ### Developer Notes Find more documentation for developers on [docs](./docs) ## Contributing [![](https://cdn.rawgit.com/jbenet/contribute-dms3-gif/master/img/contribute.gif)](https://gitlab.dms3.io/dms3/public/community/blob/master/CONTRIBUTING.md) We ❤️ all [our contributors](docs/AUTHORS); this project wouldn’t be what it is without you! If you want to help out, please see [CONTRIBUTING.md](CONTRIBUTING.md). This repository falls under the DMS3 [Code of Conduct](https://gitlab.dms3.io/dms3/public/community/blob/master/code-of-conduct.md). You can contact us on the freenode #dms3-dev channel or attend one of our [weekly calls](https://gitlab.dms3.io/dms3/public/team-mgmt/issues/674). ## License The go-dms3 project is dual-licensed under Apache 2.0 and MIT terms: - Apache License, Version 2.0, ([LICENSE-APACHE](https://gitlab.dms3.io/dms3/public/go-dms3/blob/master/LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) - MIT license ([LICENSE-MIT](https://gitlab.dms3.io/dms3/public/go-dms3/blob/master/LICENSE-MIT) or http://opensource.org/licenses/MIT)