aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-03-12 21:45:31 +0800
committerFelix Lange <fjl@twurst.com>2015-03-12 21:45:31 +0800
commit2a0e5888fdd357553e31bcee4264d9db6f486f39 (patch)
treea1d8e5463876380174f918674a03a88e8658bc0a
parent31a95151c9fb95c8527e419347556f455aebd1cb (diff)
parent485e37e889d5dd2c0461d686b122e1beb6089c16 (diff)
downloaddexon-2a0e5888fdd357553e31bcee4264d9db6f486f39.tar
dexon-2a0e5888fdd357553e31bcee4264d9db6f486f39.tar.gz
dexon-2a0e5888fdd357553e31bcee4264d9db6f486f39.tar.bz2
dexon-2a0e5888fdd357553e31bcee4264d9db6f486f39.tar.lz
dexon-2a0e5888fdd357553e31bcee4264d9db6f486f39.tar.xz
dexon-2a0e5888fdd357553e31bcee4264d9db6f486f39.tar.zst
dexon-2a0e5888fdd357553e31bcee4264d9db6f486f39.zip
Merge pull request #460 from tgerring/ethutil
Move MakeName to ethutil
-rw-r--r--cmd/utils/flags.go3
-rw-r--r--ethutil/common.go7
-rw-r--r--p2p/server.go10
3 files changed, 9 insertions, 11 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index 5c188a41e..990fb08e0 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -18,7 +18,6 @@ import (
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
- "github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/nat"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/xeth"
@@ -194,7 +193,7 @@ func GetNodeKey(ctx *cli.Context) (key *ecdsa.PrivateKey) {
func GetEthereum(clientID, version string, ctx *cli.Context) (*eth.Ethereum, error) {
return eth.New(&eth.Config{
- Name: p2p.MakeName(clientID, version),
+ Name: ethutil.MakeName(clientID, version),
DataDir: ctx.GlobalString(DataDirFlag.Name),
LogFile: ctx.GlobalString(LogFileFlag.Name),
LogLevel: ctx.GlobalInt(LogLevelFlag.Name),
diff --git a/ethutil/common.go b/ethutil/common.go
index 9b66763b8..3ade7fd16 100644
--- a/ethutil/common.go
+++ b/ethutil/common.go
@@ -13,6 +13,13 @@ import (
"github.com/kardianos/osext"
)
+// MakeName creates a node name that follows the ethereum convention
+// for such names. It adds the operation system name and Go runtime version
+// the name.
+func MakeName(name, version string) string {
+ return fmt.Sprintf("%s/v%s/%s/%s", name, version, runtime.GOOS, runtime.Version())
+}
+
func DefaultAssetPath() string {
var assetPath string
pwd, _ := os.Getwd()
diff --git a/p2p/server.go b/p2p/server.go
index 34000cb4c..9762fcc6d 100644
--- a/p2p/server.go
+++ b/p2p/server.go
@@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"net"
- "runtime"
"sync"
"time"
@@ -33,13 +32,6 @@ const (
var srvlog = logger.NewLogger("P2P Server")
var srvjslog = logger.NewJsonLogger()
-// MakeName creates a node name that follows the ethereum convention
-// for such names. It adds the operation system name and Go runtime version
-// the name.
-func MakeName(name, version string) string {
- return fmt.Sprintf("%s/v%s/%s/%s", name, version, runtime.GOOS, runtime.Version())
-}
-
// Server manages all peer connections.
//
// The fields of Server are used as configuration parameters.
@@ -54,7 +46,7 @@ type Server struct {
MaxPeers int
// Name sets the node name of this server.
- // Use MakeName to create a name that follows existing conventions.
+ // Use ethutil.MakeName to create a name that follows existing conventions.
Name string
// Bootstrap nodes are used to establish connectivity