From 344e827061c896a17124a65686bdc3fbbd03d7bb Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 17 Mar 2014 12:08:16 +0100 Subject: [PATCH] Added client string to configuration Clients can set their own client string which will be send to connected peers during the handshake. --- ethutil/config.go | 15 +++++++++------ peer.go | 3 +-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ethutil/config.go b/ethutil/config.go index 5fdc8e1c5..436c12b92 100644 --- a/ethutil/config.go +++ b/ethutil/config.go @@ -6,6 +6,7 @@ import ( "os" "os/user" "path" + "runtime" ) type LogType byte @@ -19,12 +20,13 @@ const ( type config struct { Db Database - Log *Logger - ExecPath string - Debug bool - Ver string - Pubkey []byte - Seed bool + Log *Logger + ExecPath string + Debug bool + Ver string + ClientString string + Pubkey []byte + Seed bool } var Config *config @@ -48,6 +50,7 @@ func ReadConfig(base string) *config { Config = &config{ExecPath: path, Debug: true, Ver: "0.3.1"} Config.Log = NewLogger(LogFile|LogStd, LogLevelDebug) + Config.ClientString = fmt.Sprintf("/Ethereum(G) v%s/%s", Config.Ver, runtime.GOOS) } return Config diff --git a/peer.go b/peer.go index 4e927ada4..24a5e97c9 100644 --- a/peer.go +++ b/peer.go @@ -7,7 +7,6 @@ import ( "github.com/ethereum/eth-go/ethutil" "github.com/ethereum/eth-go/ethwire" "net" - "runtime" "strconv" "strings" "sync/atomic" @@ -158,7 +157,7 @@ func NewOutboundPeer(addr string, ethereum *Ethereum, caps Caps) *Peer { connected: 0, disconnect: 0, caps: caps, - Version: fmt.Sprintf("/Ethereum(G) v%s/%s", ethutil.Config.Ver, runtime.GOOS), + Version: ethutil.Config.ClientString, } // Set up the connection in another goroutine so we don't block the main thread