Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
8c78449a
Unverified
Commit
8c78449a
authored
Oct 19, 2017
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/puppeth: reorganize stats reports to make it readable
parent
00566586
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
205 additions
and
136 deletions
+205
-136
module_dashboard.go
cmd/puppeth/module_dashboard.go
+8
-3
module_ethstats.go
cmd/puppeth/module_ethstats.go
+10
-3
module_faucet.go
cmd/puppeth/module_faucet.go
+27
-3
module_nginx.go
cmd/puppeth/module_nginx.go
+7
-3
module_node.go
cmd/puppeth/module_node.go
+31
-6
puppeth.go
cmd/puppeth/puppeth.go
+1
-1
wizard_dashboard.go
cmd/puppeth/wizard_dashboard.go
+1
-1
wizard_ethstats.go
cmd/puppeth/wizard_ethstats.go
+1
-1
wizard_faucet.go
cmd/puppeth/wizard_faucet.go
+1
-1
wizard_intro.go
cmd/puppeth/wizard_intro.go
+3
-7
wizard_netstats.go
cmd/puppeth/wizard_netstats.go
+112
-104
wizard_network.go
cmd/puppeth/wizard_network.go
+2
-2
wizard_node.go
cmd/puppeth/wizard_node.go
+1
-1
No files found.
cmd/puppeth/module_dashboard.go
View file @
8c78449a
...
...
@@ -22,6 +22,7 @@ import (
"html/template"
"math/rand"
"path/filepath"
"strconv"
"strings"
"github.com/ethereum/go-ethereum/log"
...
...
@@ -499,9 +500,13 @@ type dashboardInfos struct {
port
int
}
// String implements the stringer interface.
func
(
info
*
dashboardInfos
)
String
()
string
{
return
fmt
.
Sprintf
(
"host=%s, port=%d"
,
info
.
host
,
info
.
port
)
// Report converts the typed struct into a plain string->string map, cotnaining
// most - but not all - fields for reporting to the user.
func
(
info
*
dashboardInfos
)
Report
()
map
[
string
]
string
{
return
map
[
string
]
string
{
"Website address"
:
info
.
host
,
"Website listener port"
:
strconv
.
Itoa
(
info
.
port
),
}
}
// checkDashboard does a health-check against a dashboard container to verify if
...
...
cmd/puppeth/module_ethstats.go
View file @
8c78449a
...
...
@@ -21,6 +21,7 @@ import (
"fmt"
"math/rand"
"path/filepath"
"strconv"
"strings"
"text/template"
...
...
@@ -123,9 +124,15 @@ type ethstatsInfos struct {
banned
[]
string
}
// String implements the stringer interface.
func
(
info
*
ethstatsInfos
)
String
()
string
{
return
fmt
.
Sprintf
(
"host=%s, port=%d, secret=%s, banned=%v"
,
info
.
host
,
info
.
port
,
info
.
secret
,
info
.
banned
)
// Report converts the typed struct into a plain string->string map, cotnaining
// most - but not all - fields for reporting to the user.
func
(
info
*
ethstatsInfos
)
Report
()
map
[
string
]
string
{
return
map
[
string
]
string
{
"Website address"
:
info
.
host
,
"Website listener port"
:
strconv
.
Itoa
(
info
.
port
),
"Login secret"
:
info
.
secret
,
"Banned addresses"
:
fmt
.
Sprintf
(
"%v"
,
info
.
banned
),
}
}
// checkEthstats does a health-check against an ethstats server to verify whether
...
...
cmd/puppeth/module_faucet.go
View file @
8c78449a
...
...
@@ -18,6 +18,7 @@ package main
import
(
"bytes"
"encoding/json"
"fmt"
"html/template"
"math/rand"
...
...
@@ -25,6 +26,7 @@ import (
"strconv"
"strings"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
)
...
...
@@ -162,9 +164,31 @@ type faucetInfos struct {
captchaSecret
string
}
// String implements the stringer interface.
func
(
info
*
faucetInfos
)
String
()
string
{
return
fmt
.
Sprintf
(
"host=%s, api=%d, eth=%d, amount=%d, minutes=%d, tiers=%d, github=%s, captcha=%v, ethstats=%s"
,
info
.
host
,
info
.
port
,
info
.
node
.
portFull
,
info
.
amount
,
info
.
minutes
,
info
.
tiers
,
info
.
githubUser
,
info
.
captchaToken
!=
""
,
info
.
node
.
ethstats
)
// Report converts the typed struct into a plain string->string map, cotnaining
// most - but not all - fields for reporting to the user.
func
(
info
*
faucetInfos
)
Report
()
map
[
string
]
string
{
report
:=
map
[
string
]
string
{
"Website address"
:
info
.
host
,
"Website listener port"
:
strconv
.
Itoa
(
info
.
port
),
"Ethereum listener port"
:
strconv
.
Itoa
(
info
.
node
.
portFull
),
"Funding amount (base tier)"
:
fmt
.
Sprintf
(
"%d Ethers"
,
info
.
amount
),
"Funding cooldown (base tier)"
:
fmt
.
Sprintf
(
"%d mins"
,
info
.
minutes
),
"Funding tiers"
:
strconv
.
Itoa
(
info
.
tiers
),
"Captha protection"
:
fmt
.
Sprintf
(
"%v"
,
info
.
captchaToken
!=
""
),
"Ethstats username"
:
info
.
node
.
ethstats
,
"GitHub authentication"
:
info
.
githubUser
,
}
if
info
.
node
.
keyJSON
!=
""
{
var
key
struct
{
Address
string
`json:"address"`
}
if
err
:=
json
.
Unmarshal
([]
byte
(
info
.
node
.
keyJSON
),
&
key
);
err
==
nil
{
report
[
"Funding account"
]
=
common
.
HexToAddress
(
key
.
Address
)
.
Hex
()
}
else
{
log
.
Error
(
"Failed to retrieve signer address"
,
"err"
,
err
)
}
}
return
report
}
// checkFaucet does a health-check against an faucet server to verify whether
...
...
cmd/puppeth/module_nginx.go
View file @
8c78449a
...
...
@@ -22,6 +22,7 @@ import (
"html/template"
"math/rand"
"path/filepath"
"strconv"
"github.com/ethereum/go-ethereum/log"
)
...
...
@@ -88,9 +89,12 @@ type nginxInfos struct {
port
int
}
// String implements the stringer interface.
func
(
info
*
nginxInfos
)
String
()
string
{
return
fmt
.
Sprintf
(
"port=%d"
,
info
.
port
)
// Report converts the typed struct into a plain string->string map, cotnaining
// most - but not all - fields for reporting to the user.
func
(
info
*
nginxInfos
)
Report
()
map
[
string
]
string
{
return
map
[
string
]
string
{
"Shared listener port"
:
strconv
.
Itoa
(
info
.
port
),
}
}
// checkNginx does a health-check against an nginx reverse-proxy to verify whether
...
...
cmd/puppeth/module_node.go
View file @
8c78449a
...
...
@@ -18,6 +18,7 @@ package main
import
(
"bytes"
"encoding/json"
"fmt"
"math/rand"
"path/filepath"
...
...
@@ -25,6 +26,7 @@ import (
"strings"
"text/template"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
)
...
...
@@ -164,14 +166,37 @@ type nodeInfos struct {
gasPrice
float64
}
// String implements the stringer interface.
func
(
info
*
nodeInfos
)
String
()
string
{
discv5
:=
""
// Report converts the typed struct into a plain string->string map, cotnaining
// most - but not all - fields for reporting to the user.
func
(
info
*
nodeInfos
)
Report
()
map
[
string
]
string
{
report
:=
map
[
string
]
string
{
"Data directory"
:
info
.
datadir
,
"Listener port (full nodes)"
:
strconv
.
Itoa
(
info
.
portFull
),
"Peer count (all total)"
:
strconv
.
Itoa
(
info
.
peersTotal
),
"Peer count (light nodes)"
:
strconv
.
Itoa
(
info
.
peersLight
),
"Ethstats username"
:
info
.
ethstats
,
}
if
info
.
peersLight
>
0
{
discv5
=
fmt
.
Sprintf
(
", portv5=%d"
,
info
.
portLight
)
report
[
"Listener port (light nodes)"
]
=
strconv
.
Itoa
(
info
.
portLight
)
}
if
info
.
gasTarget
>
0
{
report
[
"Gas limit (baseline target)"
]
=
fmt
.
Sprintf
(
"%0.3f MGas"
,
info
.
gasTarget
)
report
[
"Gas price (minimum accepted)"
]
=
fmt
.
Sprintf
(
"%0.3f GWei"
,
info
.
gasPrice
)
}
if
info
.
etherbase
!=
""
{
report
[
"Miner account"
]
=
info
.
etherbase
}
if
info
.
keyJSON
!=
""
{
var
key
struct
{
Address
string
`json:"address"`
}
if
err
:=
json
.
Unmarshal
([]
byte
(
info
.
keyJSON
),
&
key
);
err
==
nil
{
report
[
"Signer account"
]
=
common
.
HexToAddress
(
key
.
Address
)
.
Hex
()
}
else
{
log
.
Error
(
"Failed to retrieve signer address"
,
"err"
,
err
)
}
}
return
fmt
.
Sprintf
(
"port=%d%s, datadir=%s, peers=%d, lights=%d, ethstats=%s, gastarget=%0.3f MGas, gasprice=%0.3f GWei"
,
info
.
portFull
,
discv5
,
info
.
datadir
,
info
.
peersTotal
,
info
.
peersLight
,
info
.
ethstats
,
info
.
gasTarget
,
info
.
gasPrice
)
return
report
}
// checkNode does a health-check against an boot or seal node server to verify
...
...
cmd/puppeth/puppeth.go
View file @
8c78449a
...
...
@@ -38,7 +38,7 @@ func main() {
},
cli
.
IntFlag
{
Name
:
"loglevel"
,
Value
:
4
,
Value
:
3
,
Usage
:
"log level to emit to the screen"
,
},
}
...
...
cmd/puppeth/wizard_dashboard.go
View file @
8c78449a
...
...
@@ -128,5 +128,5 @@ func (w *wizard) deployDashboard() {
return
}
// All ok, run a network scan to pick any changes up
w
.
networkStats
(
false
)
w
.
networkStats
()
}
cmd/puppeth/wizard_ethstats.go
View file @
8c78449a
...
...
@@ -112,5 +112,5 @@ func (w *wizard) deployEthstats() {
return
}
// All ok, run a network scan to pick any changes up
w
.
networkStats
(
false
)
w
.
networkStats
()
}
cmd/puppeth/wizard_faucet.go
View file @
8c78449a
...
...
@@ -198,5 +198,5 @@ func (w *wizard) deployFaucet() {
return
}
// All ok, run a network scan to pick any changes up
w
.
networkStats
(
false
)
w
.
networkStats
()
}
cmd/puppeth/wizard_intro.go
View file @
8c78449a
...
...
@@ -88,7 +88,7 @@ func (w *wizard) run() {
}
w
.
servers
[
server
]
=
client
}
w
.
networkStats
(
false
)
w
.
networkStats
()
}
// Basics done, loop ad infinitum about what to do
for
{
...
...
@@ -110,12 +110,11 @@ func (w *wizard) run() {
}
else
{
fmt
.
Println
(
" 4. Manage network components"
)
}
//fmt.Println(" 5. ProTips for common usecases")
choice
:=
w
.
read
()
switch
{
case
choice
==
""
||
choice
==
"1"
:
w
.
networkStats
(
false
)
w
.
networkStats
()
case
choice
==
"2"
:
if
w
.
conf
.
genesis
==
nil
{
...
...
@@ -126,7 +125,7 @@ func (w *wizard) run() {
case
choice
==
"3"
:
if
len
(
w
.
servers
)
==
0
{
if
w
.
makeServer
()
!=
""
{
w
.
networkStats
(
false
)
w
.
networkStats
()
}
}
else
{
w
.
manageServers
()
...
...
@@ -138,9 +137,6 @@ func (w *wizard) run() {
w
.
manageComponents
()
}
case
choice
==
"5"
:
w
.
networkStats
(
true
)
default
:
log
.
Error
(
"That's not something I can do"
)
}
...
...
cmd/puppeth/wizard_netstats.go
View file @
8c78449a
This diff is collapsed.
Click to expand it.
cmd/puppeth/wizard_network.go
View file @
8c78449a
...
...
@@ -53,12 +53,12 @@ func (w *wizard) manageServers() {
w
.
conf
.
flush
()
log
.
Info
(
"Disconnected existing server"
,
"server"
,
server
)
w
.
networkStats
(
false
)
w
.
networkStats
()
return
}
// If the user requested connecting a new server, do it
if
w
.
makeServer
()
!=
""
{
w
.
networkStats
(
false
)
w
.
networkStats
()
}
}
...
...
cmd/puppeth/wizard_node.go
View file @
8c78449a
...
...
@@ -156,5 +156,5 @@ func (w *wizard) deployNode(boot bool) {
log
.
Info
(
"Waiting for node to finish booting"
)
time
.
Sleep
(
3
*
time
.
Second
)
w
.
networkStats
(
false
)
w
.
networkStats
()
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment