mainly cosmetic tweaks in seed mode operation

This commit is contained in:
l0k18
2023-06-20 14:14:09 +01:00
parent e943991f8f
commit c6283ea33a
3 changed files with 40 additions and 36 deletions

View File

@@ -3,6 +3,7 @@ package introducer
import (
"context"
"errors"
"fmt"
record "github.com/libp2p/go-libp2p-record"
"sync"
@@ -47,13 +48,14 @@ func Bootstrap(ctx context.Context, host host.Host, seeds []multiaddr.Multiaddr)
c = ctx
h = host
log.I.Ln("using seeds:")
o := "using seeds:\n\n"
var bootstrapPeer *peer.AddrInfo
for _, seed := range seeds {
log.I.Ln("-", seed.String())
o+=fmt.Sprintln("-", seed.String())
if bootstrapPeer, err = peer.AddrInfoFromP2pAddr(seed); check(err) {
return
@@ -67,6 +69,8 @@ func Bootstrap(ctx context.Context, host host.Host, seeds []multiaddr.Multiaddr)
bootstrapPeers = append(bootstrapPeers, *bootstrapPeer)
}
log.I.Ln(o)
var options = []dht.Option{
dht.Mode(dht.ModeServer),
dht.ProtocolPrefix(protocolPrefix),

View File

@@ -43,11 +43,11 @@ func HostStatus(ctx context.Context, host host.Host) {
select {
case <-time.After(hostStatusInterval):
log.I.Ln()
log.I.Ln("---- host status ----")
log.I.Ln("-- peers:", len(host.Network().Peers()))
log.I.Ln("-- connections:", len(host.Network().Conns()))
log.I.Ln("---- ---- ------ ----")
log.I.Ln(`
---- host status ----
-- peers:`, len(host.Network().Peers()),`
-- connections:`, len(host.Network().Conns()),`
`)
case <-ctx.Done():

View File

@@ -83,35 +83,35 @@ func configureKey() {
return
}
log.W.Ln("")
log.W.Ln("--------------------------------------------------------")
log.W.Ln("--")
log.W.Ln("-- WARNING: The following key will be used to store")
log.W.Ln("-- your database securely, please ensure that you make")
log.W.Ln("-- a copy and store it in a secure place before using")
log.W.Ln("-- this software in a production environment.")
log.W.Ln("--")
log.W.Ln("--")
log.W.Ln("-- Failure to store this key properly will result in")
log.W.Ln("-- no longer being able to decrypt this database.")
log.W.Ln("--")
log.W.Ln("--")
log.W.Ln("-- It is recommended to use the following to generate")
log.W.Ln("-- your key:")
log.W.Ln("--")
log.W.Ln("-- indra seed keygen")
log.W.Ln("--")
log.W.Ln("-- OR")
log.W.Ln("--")
log.W.Ln("-- indra seed keygen --keyfile=/path/to/keyfile")
log.W.Ln("--")
log.W.Ln("--")
log.W.Ln("-- YOU HAVE BEEN WARNED!")
log.W.Ln("--")
log.W.Ln("-------------------------------------------------------")
log.W.Ln("-- KEY:", key.Encode(), "--")
log.W.Ln("-------------------------------------------------------")
log.W.Ln("")
log.W.Ln(`
--------------------------------------------------------
--
-- WARNING: The following key will be used to store
-- your database securely, please ensure that you make
-- a copy and store it in a secure place before using
-- this software in a production environment.
--
--
-- Failure to store this key properly will result in
-- no longer being able to decrypt this database.
--
--
-- It is recommended to use the following to generate
-- your key:
--
-- indra seed keygen
--
-- OR
--
-- indra seed keygen --keyfile=/path/to/keyfile
--
--
-- YOU HAVE BEEN WARNED!
--
-------------------------------------------------------
-- KEY:`, key.Encode(), `--
-------------------------------------------------------
`)
newKeyGenerated = true