aboutsummaryrefslogtreecommitdiffstats
path: root/mobile
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-11-25 23:55:06 +0800
committerFelix Lange <fjl@twurst.com>2016-11-25 23:55:06 +0800
commit4c8c5e2f7410d850ee6068b46c8b880f733743d4 (patch)
treec0070af77b249084355d4f659a09809d08633840 /mobile
parentd1a95c643eadd506f6ae85784d22c7823e411ee9 (diff)
downloaddexon-4c8c5e2f7410d850ee6068b46c8b880f733743d4.tar
dexon-4c8c5e2f7410d850ee6068b46c8b880f733743d4.tar.gz
dexon-4c8c5e2f7410d850ee6068b46c8b880f733743d4.tar.bz2
dexon-4c8c5e2f7410d850ee6068b46c8b880f733743d4.tar.lz
dexon-4c8c5e2f7410d850ee6068b46c8b880f733743d4.tar.xz
dexon-4c8c5e2f7410d850ee6068b46c8b880f733743d4.tar.zst
dexon-4c8c5e2f7410d850ee6068b46c8b880f733743d4.zip
cmd, ethstats, les, mobile, params: native netstats (#3336)
Diffstat (limited to 'mobile')
-rw-r--r--mobile/geth.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/mobile/geth.go b/mobile/geth.go
index 738c0c548..7ea4b2f65 100644
--- a/mobile/geth.go
+++ b/mobile/geth.go
@@ -27,6 +27,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethclient"
+ "github.com/ethereum/go-ethereum/ethstats"
"github.com/ethereum/go-ethereum/les"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p/nat"
@@ -65,6 +66,12 @@ type NodeConfig struct {
// A minimum of 16MB is always reserved.
EthereumDatabaseCache int
+ // EthereumNetStats is a netstats connection string to use to report various
+ // chain, transaction and node stats to a monitoring server.
+ //
+ // It has the form "nodename:secret@host:port"
+ EthereumNetStats string
+
// WhisperEnabled specifies whether the node should run the Whisper protocol.
WhisperEnabled bool
}
@@ -106,6 +113,7 @@ func NewNode(datadir string, config *NodeConfig) (*Node, error) {
// Create the empty networking stack
nodeConf := &node.Config{
Name: clientIdentifier,
+ Version: params.Version,
DataDir: datadir,
KeyStoreDir: filepath.Join(datadir, "keystore"), // Mobile should never use internal keystores!
NoDiscovery: true,
@@ -150,6 +158,17 @@ func NewNode(datadir string, config *NodeConfig) (*Node, error) {
}); err != nil {
return nil, fmt.Errorf("ethereum init: %v", err)
}
+ // If netstats reporting is requested, do it
+ if config.EthereumNetStats != "" {
+ if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
+ var lesServ *les.LightEthereum
+ ctx.Service(&lesServ)
+
+ return ethstats.New(config.EthereumNetStats, nil, lesServ)
+ }); err != nil {
+ return nil, fmt.Errorf("netstats init: %v", err)
+ }
+ }
}
// Register the Whisper protocol if requested
if config.WhisperEnabled {