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

Commit

Permalink
Merge pull request #268 from 0xProject/release/1.0.3-beta
Browse files Browse the repository at this point in the history
Release version 1.0.3-beta
  • Loading branch information
albrow authored Jul 17, 2019
2 parents 5288c44 + 7b519b9 commit 3dc6764
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 18 deletions.
2 changes: 1 addition & 1 deletion DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Version](https://img.shields.io/badge/version-1.0.2--beta-orange.svg)](https://github.com/0xProject/0x-mesh/releases)
[![Version](https://img.shields.io/badge/version-1.0.3--beta-orange.svg)](https://github.com/0xProject/0x-mesh/releases)

# 0x Mesh Deployment Guide

Expand Down
2 changes: 1 addition & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Version](https://img.shields.io/badge/version-1.0.2--beta-orange.svg)](https://github.com/0xProject/0x-mesh/releases)
[![Version](https://img.shields.io/badge/version-1.0.3--beta-orange.svg)](https://github.com/0xProject/0x-mesh/releases)

# 0x Mesh Development Guide

Expand Down
2 changes: 2 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Version](https://img.shields.io/badge/version-1.0.2--beta-orange.svg)](https://github.com/0xProject/0x-mesh/releases)
[![Version](https://img.shields.io/badge/version-1.0.3--beta-orange.svg)](https://github.com/0xProject/0x-mesh/releases)
[![Chat with us on Discord](https://img.shields.io/badge/chat-Discord-blueViolet.svg)](https://discord.gg/HF7fHwk)
[![GoDoc](https://godoc.org/github.com/0xProject/0x-mesh?status.svg)](https://godoc.org/github.com/0xProject/0x-mesh)
[![Circle CI](https://img.shields.io/circleci/project/0xProject/0x-mesh/master.svg)](https://circleci.com/gh/0xProject/0x-mesh/tree/master)
Expand All @@ -12,7 +12,7 @@

## Versions

You are looking at the documentation for version `1.0.2-beta`. To see the
You are looking at the documentation for version `1.0.3-beta`. To see the
documentation for a different version, visit the
[Releases Page](https://github.com/0xProject/0x-mesh/releases).

Expand Down
2 changes: 1 addition & 1 deletion USAGE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Version](https://img.shields.io/badge/version-1.0.2--beta-orange.svg)](https://github.com/0xProject/0x-mesh/releases)
[![Version](https://img.shields.io/badge/version-1.0.3--beta-orange.svg)](https://github.com/0xProject/0x-mesh/releases)

# 0x Mesh Usage Guide

Expand Down
57 changes: 46 additions & 11 deletions cmd/mesh-bootstrap/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,22 @@ import (
"context"
"fmt"
"os"
"strings"
"time"

"github.com/0xProject/0x-mesh/keys"
"github.com/0xProject/0x-mesh/loghooks"
"github.com/0xProject/0x-mesh/p2p"
libp2p "github.com/libp2p/go-libp2p"
autonat "github.com/libp2p/go-libp2p-autonat-svc"
relay "github.com/libp2p/go-libp2p-circuit"
connmgr "github.com/libp2p/go-libp2p-connmgr"
p2pcrypto "github.com/libp2p/go-libp2p-crypto"
host "github.com/libp2p/go-libp2p-host"
dht "github.com/libp2p/go-libp2p-kad-dht"
p2pnet "github.com/libp2p/go-libp2p-net"
peer "github.com/libp2p/go-libp2p-peer"
routing "github.com/libp2p/go-libp2p-routing"
ma "github.com/multiformats/go-multiaddr"
"github.com/plaid/go-envvar/envvar"
log "github.com/sirupsen/logrus"
Expand All @@ -43,10 +48,12 @@ const (
// Config contains configuration options for a Node.
type Config struct {
// Verbosity is the logging verbosity: 0=panic, 1=fatal, 2=error, 3=warn, 4=info, 5=debug 6=trace
Verbosity int `envvar:"VERBOSITY" default:"6"`
// P2PListenPort is the port on which to listen for new connections. It can be
// set to 0 to make the OS automatically choose any available port.
P2PListenPort int `envvar:"P2P_LISTEN_PORT" default:"0"`
Verbosity int `envvar:"VERBOSITY" default:"5"`
// P2PListenPort is the port on which to listen for new connections.
P2PListenPort int `envvar:"P2P_LISTEN_PORT"`
// PublicIPAddrs is a comma separated list of public IPv4 addresses at which
// the bootstrap node is accessible.
PublicIPAddrs string `envvar:"PUBLIC_IP_ADDRS"`
// PrivateKey path is the path to a private key file which will be used for
// signing messages and generating a peer ID.
PrivateKeyPath string `envvar:"PRIVATE_KEY_PATH" default:"0x_mesh/keys/privkey"`
Expand All @@ -73,6 +80,29 @@ func main() {
log.WithField("error", err).Fatal("could not initialize private key")
}

// We need to declare the newDHT function ahead of time so we can use it in
// the libp2p.Routing option.
var kadDHT *dht.IpfsDHT
newDHT := func(h host.Host) (routing.PeerRouting, error) {
var err error
kadDHT, err = p2p.NewDHT(ctx, h)
if err != nil {
log.WithField("error", err).Fatal("could not create DHT")
}
return kadDHT, err
}
// Parse advertiseAddresses from Public IPs
ipAddrs := strings.Split(config.PublicIPAddrs, ",")
advertiseAddrs := make([]ma.Multiaddr, len(ipAddrs))
for i, ipAddr := range ipAddrs {
maddrString := fmt.Sprintf("/ip4/%s/tcp/%d", ipAddr, config.P2PListenPort)
ma, err := ma.NewMultiaddr(maddrString)
if err != nil {
log.Fatal(err)
}
advertiseAddrs[i] = ma
}

// Set up the transport and the host.
// Note: 0.0.0.0 will use all available addresses.
hostAddr, err := ma.NewMultiaddr(fmt.Sprintf("/ip4/0.0.0.0/tcp/%d", config.P2PListenPort))
Expand All @@ -84,6 +114,10 @@ func main() {
libp2p.ListenAddrs(hostAddr),
libp2p.Identity(privKey),
libp2p.ConnectionManager(connManager),
libp2p.EnableRelay(relay.OptHop),
libp2p.EnableAutoRelay(),
libp2p.Routing(newDHT),
libp2p.AddrsFactory(newAddrsFactory(advertiseAddrs)),
}
basicHost, err := libp2p.New(ctx, opts...)
if err != nil {
Expand All @@ -101,12 +135,6 @@ func main() {
log.WithField("error", err).Fatal("could not enable AutoNAT service")
}

// Set up DHT for peer discovery.
kadDHT, err := p2p.NewDHT(ctx, basicHost)
if err != nil {
log.WithField("error", err).Fatal("could not create DHT")
}

// Initialize the DHT and then connect to the other bootstrap nodes.
if err := kadDHT.Bootstrap(ctx); err != nil {
log.WithField("error", err).Fatal("could not bootstrap DHT")
Expand All @@ -130,7 +158,8 @@ func main() {
}

log.WithFields(map[string]interface{}{
"addrs": basicHost.Addrs(),
"addrs": basicHost.Addrs(),
"config": config,
}).Info("started bootstrap node")

// Sleep until stopped
Expand Down Expand Up @@ -183,3 +212,9 @@ func (n *notifee) OpenedStream(network p2pnet.Network, stream p2pnet.Stream) {}

// ClosedStream is called when a stream closed
func (n *notifee) ClosedStream(network p2pnet.Network, stream p2pnet.Stream) {}

func newAddrsFactory(advertiseAddrs []ma.Multiaddr) func([]ma.Multiaddr) []ma.Multiaddr {
return func([]ma.Multiaddr) []ma.Multiaddr {
return advertiseAddrs
}
}
2 changes: 1 addition & 1 deletion core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func New(config Config) (*App, error) {
log.SetLevel(log.Level(config.Verbosity))
log.WithFields(map[string]interface{}{
"config": config,
"version": "1.0.2-beta",
"version": "1.0.3-beta",
}).Info("Initializing new core.App")

if config.EthereumRPCMaxContentLength < maxOrderSizeInBytes {
Expand Down
2 changes: 1 addition & 1 deletion examples/beta_telemetry_node/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'

services:
mesh:
image: 0xorg/mesh:1.0.2-beta
image: 0xorg/mesh:1.0.3-beta
restart: always
logging:
driver: fluentd
Expand Down

0 comments on commit 3dc6764

Please sign in to comment.