forked from cerc-io/plugeth
cmd/bootnode: print node URL on startup (#18516)
Also say that cmd/bootnode is not for production use.
This commit is contained in:
parent
f28da4f602
commit
17723a5294
@ -112,12 +112,13 @@ func main() {
|
|||||||
if !realaddr.IP.IsLoopback() {
|
if !realaddr.IP.IsLoopback() {
|
||||||
go nat.Map(natm, nil, "udp", realaddr.Port, realaddr.Port, "ethereum discovery")
|
go nat.Map(natm, nil, "udp", realaddr.Port, realaddr.Port, "ethereum discovery")
|
||||||
}
|
}
|
||||||
// TODO: react to external IP changes over time.
|
|
||||||
if ext, err := natm.ExternalIP(); err == nil {
|
if ext, err := natm.ExternalIP(); err == nil {
|
||||||
realaddr = &net.UDPAddr{IP: ext, Port: realaddr.Port}
|
realaddr = &net.UDPAddr{IP: ext, Port: realaddr.Port}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printNotice(&nodeKey.PublicKey, *realaddr)
|
||||||
|
|
||||||
if *runv5 {
|
if *runv5 {
|
||||||
if _, err := discv5.ListenUDP(nodeKey, conn, "", restrictList); err != nil {
|
if _, err := discv5.ListenUDP(nodeKey, conn, "", restrictList); err != nil {
|
||||||
utils.Fatalf("%v", err)
|
utils.Fatalf("%v", err)
|
||||||
@ -136,3 +137,13 @@ func main() {
|
|||||||
|
|
||||||
select {}
|
select {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func printNotice(nodeKey *ecdsa.PublicKey, addr net.UDPAddr) {
|
||||||
|
if addr.IP.IsUnspecified() {
|
||||||
|
addr.IP = net.IP{127, 0, 0, 1}
|
||||||
|
}
|
||||||
|
n := enode.NewV4(nodeKey, addr.IP, 0, addr.Port)
|
||||||
|
fmt.Println(n.String())
|
||||||
|
fmt.Println("Note: you're using cmd/bootnode, a developer tool.")
|
||||||
|
fmt.Println("We recommend using a regular node as bootstrap node for production deployments.")
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user