aboutsummaryrefslogtreecommitdiffstats
path: root/ethwire/client_identity.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-09-23 01:34:31 +0800
committerobscuren <geffobscura@gmail.com>2014-09-23 01:34:31 +0800
commitce149d2733bd55e8e9b16dd4b60b6bad17c3d7d9 (patch)
treeac183aa3312a4589cb3e4995cc103cfa58ef95da /ethwire/client_identity.go
parent8ef17c2fb138ae254a0cc7ac509a7ab1177ee4ac (diff)
parent7d08e4f7d14600ee4ed38fc9d435e9c2e0e0fdac (diff)
downloaddexon-ce149d2733bd55e8e9b16dd4b60b6bad17c3d7d9.tar
dexon-ce149d2733bd55e8e9b16dd4b60b6bad17c3d7d9.tar.gz
dexon-ce149d2733bd55e8e9b16dd4b60b6bad17c3d7d9.tar.bz2
dexon-ce149d2733bd55e8e9b16dd4b60b6bad17c3d7d9.tar.lz
dexon-ce149d2733bd55e8e9b16dd4b60b6bad17c3d7d9.tar.xz
dexon-ce149d2733bd55e8e9b16dd4b60b6bad17c3d7d9.tar.zst
dexon-ce149d2733bd55e8e9b16dd4b60b6bad17c3d7d9.zip
Merge branch 'release/0.6.5'
Diffstat (limited to 'ethwire/client_identity.go')
-rw-r--r--ethwire/client_identity.go22
1 files changed, 12 insertions, 10 deletions
diff --git a/ethwire/client_identity.go b/ethwire/client_identity.go
index e803406d8..ceaa9fe83 100644
--- a/ethwire/client_identity.go
+++ b/ethwire/client_identity.go
@@ -11,7 +11,6 @@ type ClientIdentity interface {
}
type SimpleClientIdentity struct {
- clientString string
clientIdentifier string
version string
customIdentifier string
@@ -25,28 +24,31 @@ func NewSimpleClientIdentity(clientIdentifier string, version string, customIden
version: version,
customIdentifier: customIdentifier,
os: runtime.GOOS,
- implementation: "Go",
+ implementation: runtime.Version(),
}
- clientIdentity.init()
+
return clientIdentity
}
func (c *SimpleClientIdentity) init() {
- c.clientString = fmt.Sprintf("%s/v%s/%s/%s/%s",
+}
+
+func (c *SimpleClientIdentity) String() string {
+ var id string
+ if len(c.customIdentifier) > 0 {
+ id = "/" + c.customIdentifier
+ }
+
+ return fmt.Sprintf("%s/v%s%s/%s/%s",
c.clientIdentifier,
c.version,
- c.customIdentifier,
+ id,
c.os,
c.implementation)
}
-func (c *SimpleClientIdentity) String() string {
- return c.clientString
-}
-
func (c *SimpleClientIdentity) SetCustomIdentifier(customIdentifier string) {
c.customIdentifier = customIdentifier
- c.init()
}
func (c *SimpleClientIdentity) GetCustomIdentifier() string {