Skip to content

Commit

Permalink
Merge pull request #3 from libp2p/master
Browse files Browse the repository at this point in the history
Getting updates
  • Loading branch information
upperwal authored Jul 30, 2018
2 parents 9f25f92 + c984cc6 commit a5dc4a9
Show file tree
Hide file tree
Showing 27 changed files with 63 additions and 1,974 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ go:
- 1.9.x

install:
- make deps-protocol-muxing
- make deps

script:
- bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh)
Expand Down
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ gx:
go get github.com/whyrusleeping/gx
go get github.com/whyrusleeping/gx-go

deps-protocol-muxing: deps
go get -u github.com/multiformats/go-multicodec
go get -u github.com/libp2p/go-msgio

deps: gx
gx --verbose install --global
gx-go rewrite
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ There is currently only one bundle of `go-libp2p`, this package. This bundle is
### Install

```bash
> go get -d github.com/libp2p/go-libp2p/...
> go get -u -d github.com/libp2p/go-libp2p/...
> cd $GOPATH/src/github.com/libp2p/go-libp2p
> make
> make deps
Expand All @@ -77,7 +77,7 @@ There is currently only one bundle of `go-libp2p`, this package. This bundle is

### Examples

Examples can be found on the [examples folder](examples).
Examples can be found in the [examples repo](https://github.com/libp2p/go-libp2p-examples).

## Development

Expand Down
24 changes: 23 additions & 1 deletion defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
secio "github.com/libp2p/go-libp2p-secio"
tcp "github.com/libp2p/go-tcp-transport"
ws "github.com/libp2p/go-ws-transport"
multiaddr "github.com/multiformats/go-multiaddr"
mplex "github.com/whyrusleeping/go-smux-multiplex"
yamux "github.com/whyrusleeping/go-smux-yamux"
)
Expand All @@ -20,7 +21,7 @@ import (
// security protocols.
var DefaultSecurity = Security(secio.ID, secio.New)

// DefaultMuxer configures libp2p to use the stream connection multiplexers.
// DefaultMuxers configures libp2p to use the stream connection multiplexers.
//
// Use this option when you want to *extend* the set of multiplexers used by
// libp2p instead of replacing them.
Expand Down Expand Up @@ -52,6 +53,23 @@ var RandomIdentity = func(cfg *Config) error {
return cfg.Apply(Identity(priv))
}

// DefaultListenAddrs configures libp2p to use default listen address
var DefaultListenAddrs = func(cfg *Config) error {
defaultIP4ListenAddr, err := multiaddr.NewMultiaddr("/ip4/0.0.0.0/tcp/0")
if err != nil {
return err
}

defaultIP6ListenAddr, err := multiaddr.NewMultiaddr("/ip6/::/tcp/0")
if err != nil {
return err
}
return cfg.Apply(ListenAddrs(
defaultIP4ListenAddr,
defaultIP6ListenAddr,
))
}

// Complete list of default options and when to fallback on them.
//
// Please *DON'T* specify default options any other way. Putting this all here
Expand All @@ -60,6 +78,10 @@ var defaults = []struct {
fallback func(cfg *Config) bool
opt Option
}{
{
fallback: func(cfg *Config) bool { return cfg.Transports == nil && cfg.ListenAddrs == nil },
opt: DefaultListenAddrs,
},
{
fallback: func(cfg *Config) bool { return cfg.Transports == nil },
opt: DefaultTransports,
Expand Down
16 changes: 2 additions & 14 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
# go-libp2p Examples

# `go-libp2p` examples and tutorials

In this folder, you can find a variety of examples to help you get started in using go-libp2p. Every example as a specific purpose and some of each incorporate a full tutorial that you can follow through, helping you expand your knowledge about libp2p and p2p networks in general.

Let us know if you find any issue or if you want to contribute and add a new tutorial, feel welcome to submit a pr, thank you!

## Examples and Tutorials

- [The libp2p 'host'](./libp2p-host)
- [Building an http proxy with libp2p](./http-proxy)
- [Protocol Multiplexing with multicodecs](./protocol-multiplexing-with-multicodecs)
- [An echo host](./echo)
- [Multicodecs with protobufs](./multipro)
- [P2P chat application](./chat)
The go-libp2p examples have moved to [go-libp2p-examples](https://github.com/libp2p/go-libp2p-examples).
49 changes: 0 additions & 49 deletions examples/chat/README.md

This file was deleted.

221 changes: 0 additions & 221 deletions examples/chat/chat.go

This file was deleted.

Loading

0 comments on commit a5dc4a9

Please sign in to comment.