aboutsummaryrefslogtreecommitdiffstats
path: root/ethwire
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-09-17 22:28:30 +0800
committerobscuren <geffobscura@gmail.com>2014-09-17 22:28:30 +0800
commitb3834d8272915d6b96d69a91ad6b9f994b29e891 (patch)
tree4e89d55454e1edeae5ed013d7026734f92f748ee /ethwire
parenta26c479182375a076833068aa6125724fda647fe (diff)
downloaddexon-b3834d8272915d6b96d69a91ad6b9f994b29e891.tar
dexon-b3834d8272915d6b96d69a91ad6b9f994b29e891.tar.gz
dexon-b3834d8272915d6b96d69a91ad6b9f994b29e891.tar.bz2
dexon-b3834d8272915d6b96d69a91ad6b9f994b29e891.tar.lz
dexon-b3834d8272915d6b96d69a91ad6b9f994b29e891.tar.xz
dexon-b3834d8272915d6b96d69a91ad6b9f994b29e891.tar.zst
dexon-b3834d8272915d6b96d69a91ad6b9f994b29e891.zip
Removed extra slash so @nicksavers gets off my back ;-)
Diffstat (limited to 'ethwire')
-rw-r--r--ethwire/client_identity.go20
1 files changed, 11 insertions, 9 deletions
diff --git a/ethwire/client_identity.go b/ethwire/client_identity.go
index e803406d8..4e4f854ba 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
@@ -27,26 +26,29 @@ func NewSimpleClientIdentity(clientIdentifier string, version string, customIden
os: runtime.GOOS,
implementation: "Go",
}
- 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 {