Skip to content

Commit

Permalink
p2p: Added log for --p2p-host-ip (#4553)
Browse files Browse the repository at this point in the history
* added log for external addr
* Merge branch 'master' into log-p2p-address
* Merge branch 'master' into log-p2p-address
* Merge branch 'master' into log-p2p-address
  • Loading branch information
princesinha19 authored and prylabs-bulldozer[bot] committed Jan 17, 2020
1 parent dab87ba commit 0605118
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions beacon-chain/p2p/service.go
Expand Up @@ -3,6 +3,7 @@ package p2p
import (
"context"
"crypto/ecdsa"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -213,6 +214,10 @@ func (s *Service) Start() {

multiAddrs := s.host.Network().ListenAddresses()
logIP4Addr(s.host.ID(), multiAddrs...)

p2pHostAddress := s.cfg.HostAddress
p2pTCPPort := s.cfg.TCPPort
logExternalIP4Addr(s.host.ID(), p2pHostAddress, p2pTCPPort)
}

// Stop the p2p service and terminate all peer connections.
Expand Down Expand Up @@ -364,3 +369,14 @@ func logIP4Addr(id peer.ID, addrs ...ma.Multiaddr) {
).Info("Node started p2p server")
}
}

func logExternalIP4Addr(id peer.ID, addr string, port uint) {
if addr != "" {
p := strconv.FormatUint(uint64(port), 10)

log.WithField(
"multiAddr",
"/ip4/"+addr+"/tcp/"+p+"/p2p/"+id.String(),
).Info("Node started external p2p server")
}
}

0 comments on commit 0605118

Please sign in to comment.