libp2p implementation in Go
Go to file
Henrique Dias a7b1927769 travis and jenkins
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
2018-08-22 14:09:37 +01:00
.gx gx publish 6.0.9 2018-08-21 17:09:12 -07:00
ci Create Jenkinsfile 2018-03-27 20:44:24 +02:00
config Add test for duplicate tpts in muxer 2018-08-21 09:25:52 -07:00
examples extract libp2p examples to go-libp2p-examples 2018-07-27 11:41:28 -07:00
p2p Merge pull request #380 from libp2p/fix/reset-ping-stream 2018-08-21 05:22:22 +00:00
.gitignore Ignore .idea 2018-02-22 10:55:06 -08:00
.travis.yml extract libp2p examples to go-libp2p-examples 2018-07-27 11:41:28 -07:00
LICENSE added docs 2015-09-30 19:08:00 -04:00
Makefile extract libp2p examples to go-libp2p-examples 2018-07-27 11:41:28 -07:00
NEWS.md add news 2018-06-14 15:24:53 -07:00
README.md travis and jenkins 2018-08-22 14:09:37 +01:00
codecov.yml Update Travis CI to use new test script and go 1.9.x 2017-12-04 16:52:42 -08:00
defaults.go [muxer] set mplex version to 6.7.0 2018-07-30 22:29:16 +03:00
error_util.go refactor for transport changes 2018-06-04 21:22:24 -07:00
libp2p.go Fix a typo in doc 2018-08-15 18:36:57 +08:00
libp2p_test.go modified regex for ipv6 2018-07-28 02:48:09 +05:30
options.go refactor for transport changes 2018-06-04 21:22:24 -07:00
package-list.json travis and jenkins 2018-08-22 14:09:37 +01:00
package.json gx publish 6.0.9 2018-08-21 17:09:12 -07:00

README.md

libp2p hex logo

The Go implementation of the libp2p Networking Stack.



Project status

Throughput Graph

Weekly Core Dev Calls

Table of Contents

Background

libp2p is a networking stack and library modularized out of The IPFS Project, and bundled separately for other tools to use.

libp2p is the product of a long, and arduous quest of understanding -- a deep dive into the internet's network stack, and plentiful peer-to-peer protocols from the past. Building large scale peer-to-peer systems has been complex and difficult in the last 15 years, and libp2p is a way to fix that. It is a "network stack" -- a protocol suite -- that cleanly separates concerns, and enables sophisticated applications to only use the protocols they absolutely need, without giving up interoperability and upgradeability. libp2p grew out of IPFS, but it is built so that lots of people can use it, for lots of different projects.

We will be writing a set of docs, posts, tutorials, and talks to explain what p2p is, why it is tremendously useful, and how it can help your existing and new projects. But in the meantime, check out

Bundles

There is currently only one bundle of go-libp2p, this package. This bundle is used by go-ipfs.

Usage

go-libp2p repo is a place holder for the list of Go modules that compose Go libp2p, as well as its entry point.

Install

> go get -u -d github.com/libp2p/go-libp2p/...
> cd $GOPATH/src/github.com/libp2p/go-libp2p
> make
> make deps

API

GoDoc

Examples

Examples can be found in the examples repo.

Development

Dependencies

While developing, you need to use gx to install and link your dependencies, to do that, run:

> make deps

Before commiting and pushing to Github, make sure to rewind the gx'ify of dependencies. You can do that with:

> make publish

Tests

Running of individual tests is done through gx test <path to test>

$ cd $GOPATH/src/github.com/libp2p/go-libp2p
$ make deps
$ gx test ./p2p/<path of module you want to run tests for>

Packages

This table is generated using the module package-table with package-table --data=package-list.json.

List of packages currently in existence for libp2p:

Name CI/Travis CI/Jenkins Coverage
Libp2p
interface-libp2p Travis CI jenkins codecov
libp2p Travis CI jenkins codecov
Connection
interface-connection Travis CI jenkins codecov
go-libp2p-net Travis CI jenkins codecov
Transport
interface-transport Travis CI jenkins codecov
go-ws-transport Travis CI jenkins codecov
go-libp2p-transport Travis CI jenkins codecov
go-tcp-transport Travis CI jenkins codecov
go-libp2p-transport-upgrader Travis CI jenkins codecov
Crypto Channels
go-libp2p-secio Travis CI jenkins codecov
Stream Muxers
go-stream-muxer Travis CI jenkins codecov
Discovery
interface-peer-discovery Travis CI jenkins codecov
NAT Traversal
go-libp2p-circuit Travis CI jenkins codecov
go-libp2p-nat Travis CI jenkins codecov
Data Types
go-libp2p-peer Travis CI jenkins codecov
go-libp2p-peerstore Travis CI jenkins codecov
go-libp2p-protocol Travis CI jenkins codecov
Content Routing
interface-content-routing Travis CI jenkins codecov
Peer Routing
interface-peer-routing Travis CI jenkins codecov
Record Store
interface-record-store Travis CI jenkins codecov
Miscellaneous
go-libp2p-crypto Travis CI jenkins codecov
go-libp2p-interface-connmgr Travis CI jenkins codecov
go-libp2p-swarm Travis CI jenkins codecov
go-libp2p-host Travis CI jenkins codecov
go-libp2p-blankhost Travis CI jenkins codecov
go-conn-security-multistream Travis CI jenkins codecov
go-conn-security Travis CI jenkins codecov
go-libp2p-interface-pnet Travis CI jenkins codecov
go-libp2p-metrics Travis CI jenkins codecov
Utilities
go-libp2p-loggables Travis CI jenkins codecov
go-maddr-filter Travis CI jenkins codecov
go-libp2p-netutil Travis CI jenkins codecov
go-testutil Travis CI jenkins codecov

Contribute

go-libp2p is part of The IPFS Project, and is MIT licensed open source software. We welcome contributions big and small! Take a look at the community contributing notes. Please make sure to check the issues. Search the closed ones before reporting things, and help us with the open ones.

Guidelines:

  • read the libp2p spec
  • please make branches + pull-request, even if working on the main repository
  • ask questions or talk about things in Issues or #ipfs on freenode.
  • ensure you are able to contribute (no legal issues please-- we use the DCO)
  • run go fmt before pushing any code
  • run golint and go vet too -- some things (like protobuf files) are expected to fail.
  • get in touch with @jbenet and @diasdavid about how best to contribute
  • have fun!

There's a few things you can do right now to help out:

  • Go through the modules below and check out existing issues. This would be especially useful for modules in active development. Some knowledge of IPFS/libp2p may be required, as well as the infrasture behind it - for instance, you may need to read up on p2p and more complex operations like muxing to be able to help technically.
  • Perform code reviews.
  • Add tests. There can never be enough tests.

Modularizing go-libp2p

We have currently a work in progress of modularizing go-libp2p from a repo monolith to several packages in different repos that can be reused for other projects of swapped for custom libp2p builds.

We want to maintain history, so we'll use git-subtree for extracting packages. Find instructions below:

# 1) create the extracted tree (has the directory specified as -P as its root)
> cd go-libp2p/
> git subtree split -P p2p/crypto/secio/ -b libp2p-secio
62b0a5c21574bcbe06c422785cd5feff378ae5bd
# important to delete the tree now, so that outdated imports fail in step 5
> git rm -r p2p/crypto/secio/
> git commit
> cd ../

# 2) make the new repo
> mkdir go-libp2p-secio
> cd go-libp2p-secio/
> git init && git commit --allow-empty

# 3) fetch the extracted tree from the previous repo
> git remote add libp2p ../go-libp2p
> git fetch libp2p
> git reset --hard libp2p/libp2p-secio

# 4) update self import paths
> sed -someflagsidontknow 'go-libp2p/p2p/crypto/secio' 'golibp2p-secio'
> git commit

# 5) create package.json and check all imports are correct
> vim package.json
> gx --verbose install --global
> gx-go rewrite
> go test ./...
> gx-go rewrite --undo
> git commit

# 4) make the package ready
> vim README.md LICENSE
> git commit

# 5) bump the version separately
> vim package.json
> gx publish
> git add package.json .gx/
> git commit -m 'Publish 1.2.3'

# 6) clean up and push
> git remote rm libp2p
> git push origin master