Move MakeName to ethutil
This commit is contained in:
parent
587f748d92
commit
485e37e889
@ -18,7 +18,6 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/ethutil"
|
"github.com/ethereum/go-ethereum/ethutil"
|
||||||
"github.com/ethereum/go-ethereum/event"
|
"github.com/ethereum/go-ethereum/event"
|
||||||
"github.com/ethereum/go-ethereum/logger"
|
"github.com/ethereum/go-ethereum/logger"
|
||||||
"github.com/ethereum/go-ethereum/p2p"
|
|
||||||
"github.com/ethereum/go-ethereum/p2p/nat"
|
"github.com/ethereum/go-ethereum/p2p/nat"
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
"github.com/ethereum/go-ethereum/xeth"
|
"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) {
|
func GetEthereum(clientID, version string, ctx *cli.Context) (*eth.Ethereum, error) {
|
||||||
return eth.New(ð.Config{
|
return eth.New(ð.Config{
|
||||||
Name: p2p.MakeName(clientID, version),
|
Name: ethutil.MakeName(clientID, version),
|
||||||
DataDir: ctx.GlobalString(DataDirFlag.Name),
|
DataDir: ctx.GlobalString(DataDirFlag.Name),
|
||||||
LogFile: ctx.GlobalString(LogFileFlag.Name),
|
LogFile: ctx.GlobalString(LogFileFlag.Name),
|
||||||
LogLevel: ctx.GlobalInt(LogLevelFlag.Name),
|
LogLevel: ctx.GlobalInt(LogLevelFlag.Name),
|
||||||
|
@ -13,6 +13,13 @@ import (
|
|||||||
"github.com/kardianos/osext"
|
"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 {
|
func DefaultAssetPath() string {
|
||||||
var assetPath string
|
var assetPath string
|
||||||
pwd, _ := os.Getwd()
|
pwd, _ := os.Getwd()
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"runtime"
|
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -33,13 +32,6 @@ const (
|
|||||||
var srvlog = logger.NewLogger("P2P Server")
|
var srvlog = logger.NewLogger("P2P Server")
|
||||||
var srvjslog = logger.NewJsonLogger()
|
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.
|
// Server manages all peer connections.
|
||||||
//
|
//
|
||||||
// The fields of Server are used as configuration parameters.
|
// The fields of Server are used as configuration parameters.
|
||||||
@ -54,7 +46,7 @@ type Server struct {
|
|||||||
MaxPeers int
|
MaxPeers int
|
||||||
|
|
||||||
// Name sets the node name of this server.
|
// 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
|
Name string
|
||||||
|
|
||||||
// Bootstrap nodes are used to establish connectivity
|
// Bootstrap nodes are used to establish connectivity
|
||||||
|
Loading…
Reference in New Issue
Block a user