mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
Added arbitray data Ethstats
This commit is contained in:
parent
55c34d660b
commit
b02c742268
1 changed files with 26 additions and 10 deletions
|
|
@ -86,6 +86,20 @@ type fullNodeBackend interface {
|
||||||
SuggestGasTipCap(ctx context.Context) (*big.Int, error)
|
SuggestGasTipCap(ctx context.Context) (*big.Int, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type EthstatsDataType struct {
|
||||||
|
kv map[string]string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function to add data to EthstatsData
|
||||||
|
func (e *EthstatsDataType) AddKV(key, val string) {
|
||||||
|
e.kv[key] = val
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arbitrary Data that can be included
|
||||||
|
var EthstatsData = &EthstatsDataType{
|
||||||
|
kv: make(map[string]string),
|
||||||
|
}
|
||||||
|
|
||||||
// Service implements an Ethereum netstats reporting daemon that pushes local
|
// Service implements an Ethereum netstats reporting daemon that pushes local
|
||||||
// chain statistics up to a monitoring server.
|
// chain statistics up to a monitoring server.
|
||||||
type Service struct {
|
type Service struct {
|
||||||
|
|
@ -466,16 +480,17 @@ func (s *Service) readLoop(conn *connWrapper) {
|
||||||
// nodeInfo is the collection of meta information about a node that is displayed
|
// nodeInfo is the collection of meta information about a node that is displayed
|
||||||
// on the monitoring page.
|
// on the monitoring page.
|
||||||
type nodeInfo struct {
|
type nodeInfo struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Node string `json:"node"`
|
Node string `json:"node"`
|
||||||
Port int `json:"port"`
|
Port int `json:"port"`
|
||||||
Network string `json:"net"`
|
Network string `json:"net"`
|
||||||
Protocol string `json:"protocol"`
|
Protocol string `json:"protocol"`
|
||||||
API string `json:"api"`
|
API string `json:"api"`
|
||||||
Os string `json:"os"`
|
Os string `json:"os"`
|
||||||
OsVer string `json:"os_v"`
|
OsVer string `json:"os_v"`
|
||||||
Client string `json:"client"`
|
Client string `json:"client"`
|
||||||
History bool `json:"canUpdateHistory"`
|
History bool `json:"canUpdateHistory"`
|
||||||
|
Data map[string]string `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// authMsg is the authentication infos needed to login to a monitoring server.
|
// authMsg is the authentication infos needed to login to a monitoring server.
|
||||||
|
|
@ -513,6 +528,7 @@ func (s *Service) login(conn *connWrapper) error {
|
||||||
OsVer: runtime.GOARCH,
|
OsVer: runtime.GOARCH,
|
||||||
Client: "0.1.1",
|
Client: "0.1.1",
|
||||||
History: true,
|
History: true,
|
||||||
|
Data: EthstatsData.kv,
|
||||||
},
|
},
|
||||||
Secret: s.pass,
|
Secret: s.pass,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue