Merge branch 'ind-bootstrap' into proc-debug
# Conflicts: # version.go
This commit is contained in:
@@ -2,16 +2,16 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/indra-labs/indra"
|
||||
"github.com/indra-labs/indra/pkg/docker"
|
||||
"github.com/indra-labs/indra/pkg/app"
|
||||
"github.com/indra-labs/indra/pkg/cmds"
|
||||
"github.com/indra-labs/indra/pkg/docker"
|
||||
log2 "github.com/indra-labs/indra/pkg/log"
|
||||
"github.com/indra-labs/indra/pkg/opts/config"
|
||||
"github.com/indra-labs/indra/pkg/opts/meta"
|
||||
"github.com/indra-labs/indra/pkg/opts/toggle"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/client"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
@@ -33,19 +33,19 @@ var commands = &cmds.Command{
|
||||
Name: "release",
|
||||
Description: "Builds the indra docker image and pushes it to a list of docker repositories.",
|
||||
Documentation: lorem,
|
||||
Default: cmds.Tags("release"),
|
||||
Configs: config.Opts{
|
||||
Default: cmds.Tags("release"),
|
||||
Configs: config.Opts{
|
||||
"stable": toggle.New(meta.Data{
|
||||
Label: "stable",
|
||||
Description: "tag the current build as stable.",
|
||||
Documentation: lorem,
|
||||
Default: "false",
|
||||
Default: "false",
|
||||
}),
|
||||
"push": toggle.New(meta.Data{
|
||||
Label: "push",
|
||||
Description: "push the newly built/tagged images to the docker repositories.",
|
||||
Documentation: lorem,
|
||||
Default: "false",
|
||||
Default: "false",
|
||||
}),
|
||||
},
|
||||
Entrypoint: func(command *cmds.Command, args []string) error {
|
||||
@@ -119,4 +119,4 @@ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
|
||||
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
||||
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
|
||||
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
|
||||
culpa qui officia deserunt mollit anim id est laborum.`
|
||||
culpa qui officia deserunt mollit anim id est laborum.`
|
||||
|
||||
@@ -69,8 +69,8 @@ var commands = &cmds.Command{
|
||||
Documentation: lorem,
|
||||
Configs: config.Opts{
|
||||
"key": text.New(meta.Data{
|
||||
Label: "key",
|
||||
Description: "A base58 encoded private key.",
|
||||
Label: "key",
|
||||
Description: "A base58 encoded private key.",
|
||||
Documentation: lorem,
|
||||
}),
|
||||
"seed": list.New(meta.Data{
|
||||
@@ -105,11 +105,11 @@ var commands = &cmds.Command{
|
||||
|
||||
server.DefaultConfig.PrivKey = privKey
|
||||
|
||||
for _, listener := range c.GetListValue("listen"){
|
||||
for _, listener := range c.GetListValue("listen") {
|
||||
server.DefaultConfig.ListenAddresses = append(server.DefaultConfig.ListenAddresses, multiaddr.StringCast(listener))
|
||||
}
|
||||
|
||||
for _, seed := range c.GetListValue("seed"){
|
||||
for _, seed := range c.GetListValue("seed") {
|
||||
server.DefaultConfig.SeedAddresses = append(server.DefaultConfig.SeedAddresses, multiaddr.StringCast(seed))
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ type DNSSeedAddress struct {
|
||||
func NewSeedAddress(dns string, id string) *DNSSeedAddress {
|
||||
|
||||
return &DNSSeedAddress{
|
||||
ID: id,
|
||||
ID: id,
|
||||
DNSAddress: dns,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ func HostStatus(ctx context.Context, host host.Host) {
|
||||
|
||||
select {
|
||||
|
||||
case <- ctx.Done():
|
||||
case <-ctx.Done():
|
||||
|
||||
log.I.Ln("shutting down metrics.hoststatus")
|
||||
|
||||
@@ -40,8 +40,8 @@ func HostStatus(ctx context.Context, host host.Host) {
|
||||
}
|
||||
|
||||
log.I.Ln("---- host status ----")
|
||||
log.I.Ln("-- peers:",len(host.Network().Peers()))
|
||||
log.I.Ln("-- connections:",len(host.Network().Conns()))
|
||||
log.I.Ln("-- peers:", len(host.Network().Peers()))
|
||||
log.I.Ln("-- connections:", len(host.Network().Conns()))
|
||||
log.I.Ln("---- ---- ------ ----")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,9 @@ var (
|
||||
|
||||
var (
|
||||
defaultConnectionAttempts uint = 3
|
||||
defaultConnectionAttemptInterval time.Duration = 10 * time.Second
|
||||
defaultConnectionAttemptInterval = 10 * time.Second
|
||||
|
||||
defaultConnectionsMax uint = 32
|
||||
defaultConnectionsToSatisfy uint = 5
|
||||
)
|
||||
|
||||
@@ -28,7 +29,7 @@ var (
|
||||
wg sync.WaitGroup
|
||||
m sync.Mutex
|
||||
c context.Context
|
||||
h host.Host = nil
|
||||
h host.Host = nil
|
||||
|
||||
failedChan = make(chan error)
|
||||
)
|
||||
@@ -42,13 +43,16 @@ func connection_attempt(peer *peer.AddrInfo, attempts_left uint) {
|
||||
return
|
||||
}
|
||||
|
||||
if err := h.Connect(c, *peer); check(err) {
|
||||
if err := h.Connect(c, *peer); err != nil {
|
||||
|
||||
log.D.Ln("connection connection_attempt failed:", peer.ID)
|
||||
log.I.Ln("connection attempt failed:", peer.ID)
|
||||
|
||||
time.Sleep(defaultConnectionAttemptInterval)
|
||||
|
||||
connection_attempt(peer, attempts_left - 1)
|
||||
select {
|
||||
case <-time.After(defaultConnectionAttemptInterval):
|
||||
connection_attempt(peer, attempts_left-1)
|
||||
case <-c.Done():
|
||||
wg.Done()
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -18,14 +18,13 @@ func NewMultiAddr(addr string) (maddr multiaddr.Multiaddr) {
|
||||
|
||||
var DefaultConfig = &Config{
|
||||
ListenAddresses: []multiaddr.Multiaddr{},
|
||||
SeedAddresses: []multiaddr.Multiaddr{},
|
||||
SeedAddresses: []multiaddr.Multiaddr{},
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
|
||||
PrivKey crypto.PrivKey
|
||||
|
||||
PublicAddress multiaddr.Multiaddr
|
||||
SeedAddresses []multiaddr.Multiaddr
|
||||
SeedAddresses []multiaddr.Multiaddr
|
||||
ListenAddresses []multiaddr.Multiaddr
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ var (
|
||||
)
|
||||
|
||||
var (
|
||||
userAgent = "/indra:"+indra.SemVer+"/"
|
||||
userAgent = "/indra:" + indra.SemVer + "/"
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBase58(t *testing.T){
|
||||
func TestBase58(t *testing.T) {
|
||||
|
||||
var err error
|
||||
var priv1, priv2 crypto.PrivKey
|
||||
|
||||
Reference in New Issue
Block a user