Skip to content

Commit 17723a5

Browse files
authored
cmd/bootnode: print node URL on startup (#18516)
Also say that cmd/bootnode is not for production use.
1 parent f28da4f commit 17723a5

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎cmd/bootnode/main.go‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,13 @@ func main() {
112112
if !realaddr.IP.IsLoopback() {
113113
go nat.Map(natm, nil, "udp", realaddr.Port, realaddr.Port, "ethereum discovery")
114114
}
115-
// TODO: react to external IP changes over time.
116115
if ext, err := natm.ExternalIP(); err == nil {
117116
realaddr = &net.UDPAddr{IP: ext, Port: realaddr.Port}
118117
}
119118
}
120119

120+
printNotice(&nodeKey.PublicKey, *realaddr)
121+
121122
if *runv5 {
122123
if _, err := discv5.ListenUDP(nodeKey, conn, "", restrictList); err != nil {
123124
utils.Fatalf("%v", err)
@@ -136,3 +137,13 @@ func main() {
136137

137138
select {}
138139
}
140+
141+
func printNotice(nodeKey *ecdsa.PublicKey, addr net.UDPAddr) {
142+
if addr.IP.IsUnspecified() {
143+
addr.IP = net.IP{127, 0, 0, 1}
144+
}
145+
n := enode.NewV4(nodeKey, addr.IP, 0, addr.Port)
146+
fmt.Println(n.String())
147+
fmt.Println("Note: you're using cmd/bootnode, a developer tool.")
148+
fmt.Println("We recommend using a regular node as bootstrap node for production deployments.")
149+
}

0 commit comments

Comments
 (0)