mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
diagnostics - added query for bootnodes (#8344)
This commit is contained in:
parent
3d6d2a7c25
commit
ae88a69511
25
diagnostics/bootnodes.go
Normal file
25
diagnostics/bootnodes.go
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package diagnostics
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/ledgerwatch/erigon/turbo/node"
|
||||||
|
)
|
||||||
|
|
||||||
|
func SetupBootnodesAccess(metricsMux *http.ServeMux, node *node.ErigonNode) {
|
||||||
|
metricsMux.HandleFunc("/bootnodes", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||||
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
|
||||||
|
bootnodes := node.Node().Config().P2P.BootstrapNodesV5
|
||||||
|
|
||||||
|
btNodes := make([]string, 0, len(bootnodes))
|
||||||
|
|
||||||
|
for _, bootnode := range bootnodes {
|
||||||
|
btNodes = append(btNodes, bootnode.String())
|
||||||
|
}
|
||||||
|
|
||||||
|
json.NewEncoder(w).Encode(btNodes)
|
||||||
|
})
|
||||||
|
}
|
@ -26,5 +26,6 @@ func Setup(ctx *cli.Context, metricsMux *http.ServeMux, node *node.ErigonNode) {
|
|||||||
SetupHeaderDownloadStats(debugMux)
|
SetupHeaderDownloadStats(debugMux)
|
||||||
SetupNodeInfoAccess(debugMux, node)
|
SetupNodeInfoAccess(debugMux, node)
|
||||||
SetupPeersAccess(ctx, debugMux, node)
|
SetupPeersAccess(ctx, debugMux, node)
|
||||||
|
SetupBootnodesAccess(debugMux, node)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,10 @@ func (eri *ErigonNode) Backend() *eth.Ethereum {
|
|||||||
return eri.backend
|
return eri.backend
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (eri *ErigonNode) Node() *node.Node {
|
||||||
|
return eri.stack
|
||||||
|
}
|
||||||
|
|
||||||
func (eri *ErigonNode) Close() {
|
func (eri *ErigonNode) Close() {
|
||||||
eri.stack.Close()
|
eri.stack.Close()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user