mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 09:23:48 +00:00
p2p, cmd/utils: remove DiscoveryV5Addr
This commit is contained in:
parent
6e0e2f6ade
commit
97472e2540
6 changed files with 4 additions and 20 deletions
|
|
@ -223,7 +223,6 @@ func newFaucet(genesis *core.Genesis, port int, enodes []*discv5.Node, network u
|
||||||
NoDiscovery: true,
|
NoDiscovery: true,
|
||||||
DiscoveryV5: true,
|
DiscoveryV5: true,
|
||||||
ListenAddr: fmt.Sprintf(":%d", port),
|
ListenAddr: fmt.Sprintf(":%d", port),
|
||||||
DiscoveryV5Addr: fmt.Sprintf(":%d", port+1),
|
|
||||||
MaxPeers: 25,
|
MaxPeers: 25,
|
||||||
BootstrapNodesV5: enodes,
|
BootstrapNodesV5: enodes,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -635,14 +635,6 @@ func setListenAddress(ctx *cli.Context, cfg *p2p.Config) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// setDiscoveryV5Address creates a UDP listening address string from set command
|
|
||||||
// line flags for the V5 discovery protocol.
|
|
||||||
func setDiscoveryV5Address(ctx *cli.Context, cfg *p2p.Config) {
|
|
||||||
if ctx.GlobalIsSet(ListenPortFlag.Name) {
|
|
||||||
cfg.DiscoveryV5Addr = fmt.Sprintf(":%d", ctx.GlobalInt(ListenPortFlag.Name)+1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// setNAT creates a port mapper from command line flags.
|
// setNAT creates a port mapper from command line flags.
|
||||||
func setNAT(ctx *cli.Context, cfg *p2p.Config) {
|
func setNAT(ctx *cli.Context, cfg *p2p.Config) {
|
||||||
if ctx.GlobalIsSet(NATFlag.Name) {
|
if ctx.GlobalIsSet(NATFlag.Name) {
|
||||||
|
|
@ -796,7 +788,6 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
|
||||||
setNodeKey(ctx, cfg)
|
setNodeKey(ctx, cfg)
|
||||||
setNAT(ctx, cfg)
|
setNAT(ctx, cfg)
|
||||||
setListenAddress(ctx, cfg)
|
setListenAddress(ctx, cfg)
|
||||||
setDiscoveryV5Address(ctx, cfg)
|
|
||||||
setBootstrapNodes(ctx, cfg)
|
setBootstrapNodes(ctx, cfg)
|
||||||
setBootstrapNodesV5(ctx, cfg)
|
setBootstrapNodesV5(ctx, cfg)
|
||||||
|
|
||||||
|
|
@ -832,7 +823,6 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
|
||||||
// --dev mode can't use p2p networking.
|
// --dev mode can't use p2p networking.
|
||||||
cfg.MaxPeers = 0
|
cfg.MaxPeers = 0
|
||||||
cfg.ListenAddr = ":0"
|
cfg.ListenAddr = ":0"
|
||||||
cfg.DiscoveryV5Addr = ":0"
|
|
||||||
cfg.NoDiscovery = true
|
cfg.NoDiscovery = true
|
||||||
cfg.DiscoveryV5 = false
|
cfg.DiscoveryV5 = false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,6 @@ func NewNode(datadir string, config *NodeConfig) (stack *Node, _ error) {
|
||||||
P2P: p2p.Config{
|
P2P: p2p.Config{
|
||||||
NoDiscovery: true,
|
NoDiscovery: true,
|
||||||
DiscoveryV5: true,
|
DiscoveryV5: true,
|
||||||
DiscoveryV5Addr: ":0",
|
|
||||||
BootstrapNodesV5: config.BootstrapNodes.nodes,
|
BootstrapNodesV5: config.BootstrapNodes.nodes,
|
||||||
ListenAddr: ":0",
|
ListenAddr: ":0",
|
||||||
NAT: nat.Any(),
|
NAT: nat.Any(),
|
||||||
|
|
|
||||||
|
|
@ -41,10 +41,9 @@ var DefaultConfig = Config{
|
||||||
WSPort: DefaultWSPort,
|
WSPort: DefaultWSPort,
|
||||||
WSModules: []string{"net", "web3"},
|
WSModules: []string{"net", "web3"},
|
||||||
P2P: p2p.Config{
|
P2P: p2p.Config{
|
||||||
ListenAddr: ":30303",
|
ListenAddr: ":30303",
|
||||||
DiscoveryV5Addr: ":30304",
|
MaxPeers: 25,
|
||||||
MaxPeers: 25,
|
NAT: nat.Any(),
|
||||||
NAT: nat.Any(),
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -643,7 +643,7 @@ func (s *ticketStore) gotTopicNodes(from *Node, hash common.Hash, nodes []rpcNod
|
||||||
if ip.IsUnspecified() || ip.IsLoopback() {
|
if ip.IsUnspecified() || ip.IsLoopback() {
|
||||||
ip = from.IP
|
ip = from.IP
|
||||||
}
|
}
|
||||||
n := NewNode(node.ID, ip, node.UDP-1, node.TCP-1) // subtract one from port while discv5 is running in test mode on UDPport+1
|
n := NewNode(node.ID, ip, node.UDP, node.TCP)
|
||||||
select {
|
select {
|
||||||
case chn <- n:
|
case chn <- n:
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -78,9 +78,6 @@ type Config struct {
|
||||||
// protocol should be started or not.
|
// protocol should be started or not.
|
||||||
DiscoveryV5 bool `toml:",omitempty"`
|
DiscoveryV5 bool `toml:",omitempty"`
|
||||||
|
|
||||||
// Listener address for the V5 discovery protocol UDP traffic.
|
|
||||||
DiscoveryV5Addr string `toml:",omitempty"`
|
|
||||||
|
|
||||||
// Name sets the node name of this server.
|
// Name sets the node name of this server.
|
||||||
// Use common.MakeName to create a name that follows existing conventions.
|
// Use common.MakeName to create a name that follows existing conventions.
|
||||||
Name string `toml:"-"`
|
Name string `toml:"-"`
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue