cmd, mobile, node, p2p: surface the discovery V5 bootnodes

This commit is contained in:
Péter Szilágyi
2016-11-09 16:35:04 +02:00
parent de4b39a1a3
commit b61f48e5aa
8 changed files with 101 additions and 68 deletions

View File

@ -32,6 +32,7 @@ import (
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/discv5"
"github.com/ethereum/go-ethereum/p2p/nat"
)
@ -95,16 +96,23 @@ type Config struct {
// or not. Disabling is usually useful for protocol debugging (manual topology).
NoDiscovery bool
// DiscoveryV5 specifies whether the the new topic-discovery based V5 discovery
// protocol should be started or not.
DiscoveryV5 bool
// Bootstrap nodes used to establish connectivity with the rest of the network.
// Listener address for the V5 discovery protocol UDP traffic.
DiscoveryV5Addr string
// BootstrapNodes used to establish connectivity with the rest of the network.
BootstrapNodes []*discover.Node
// BootstrapNodesV5 used to establish connectivity with the rest of the network
// using the V5 discovery protocol.
BootstrapNodesV5 []*discv5.Node
// Network interface address on which the node should listen for inbound peers.
ListenAddr string
ListenAddrV5 string
// If set to a non-nil value, the given NAT port mapper is used to make the
// listening port available to the Internet.
NAT nat.Interface

View File

@ -154,21 +154,22 @@ func (n *Node) Start() error {
// Initialize the p2p server. This creates the node key and
// discovery databases.
n.serverConfig = p2p.Config{
PrivateKey: n.config.NodeKey(),
Name: n.config.NodeName(),
Discovery: !n.config.NoDiscovery,
DiscoveryV5: n.config.DiscoveryV5,
BootstrapNodes: n.config.BootstrapNodes,
StaticNodes: n.config.StaticNodes(),
TrustedNodes: n.config.TrusterNodes(),
NodeDatabase: n.config.NodeDB(),
ListenAddr: n.config.ListenAddr,
ListenAddrV5: n.config.ListenAddrV5,
NAT: n.config.NAT,
Dialer: n.config.Dialer,
NoDial: n.config.NoDial,
MaxPeers: n.config.MaxPeers,
MaxPendingPeers: n.config.MaxPendingPeers,
PrivateKey: n.config.NodeKey(),
Name: n.config.NodeName(),
Discovery: !n.config.NoDiscovery,
DiscoveryV5: n.config.DiscoveryV5,
DiscoveryV5Addr: n.config.DiscoveryV5Addr,
BootstrapNodes: n.config.BootstrapNodes,
BootstrapNodesV5: n.config.BootstrapNodesV5,
StaticNodes: n.config.StaticNodes(),
TrustedNodes: n.config.TrusterNodes(),
NodeDatabase: n.config.NodeDB(),
ListenAddr: n.config.ListenAddr,
NAT: n.config.NAT,
Dialer: n.config.Dialer,
NoDial: n.config.NoDial,
MaxPeers: n.config.MaxPeers,
MaxPendingPeers: n.config.MaxPendingPeers,
}
running := &p2p.Server{Config: n.serverConfig}
glog.V(logger.Info).Infoln("instance:", n.serverConfig.Name)