aboutsummaryrefslogtreecommitdiffstats
path: root/p2p
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-02-14 06:54:34 +0800
committerFelix Lange <fjl@twurst.com>2015-02-14 06:54:34 +0800
commit4bef3ce284574c7e0e9a76004e076fc686b13bf6 (patch)
tree34daa88f41f8fae055ec1d11677aeabcb3925da6 /p2p
parent49a739c8d647739b3d815966f8854a4e9978df56 (diff)
downloadgo-tangerine-4bef3ce284574c7e0e9a76004e076fc686b13bf6.tar
go-tangerine-4bef3ce284574c7e0e9a76004e076fc686b13bf6.tar.gz
go-tangerine-4bef3ce284574c7e0e9a76004e076fc686b13bf6.tar.bz2
go-tangerine-4bef3ce284574c7e0e9a76004e076fc686b13bf6.tar.lz
go-tangerine-4bef3ce284574c7e0e9a76004e076fc686b13bf6.tar.xz
go-tangerine-4bef3ce284574c7e0e9a76004e076fc686b13bf6.tar.zst
go-tangerine-4bef3ce284574c7e0e9a76004e076fc686b13bf6.zip
p2p: print Cap as name/version
Diffstat (limited to 'p2p')
-rw-r--r--p2p/protocol.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/p2p/protocol.go b/p2p/protocol.go
index fe359fc54..5fa395eda 100644
--- a/p2p/protocol.go
+++ b/p2p/protocol.go
@@ -1,5 +1,7 @@
package p2p
+import "fmt"
+
// Protocol represents a P2P subprotocol implementation.
type Protocol struct {
// Name should contain the official protocol name,
@@ -37,6 +39,10 @@ func (cap Cap) RlpData() interface{} {
return []interface{}{cap.Name, cap.Version}
}
+func (cap Cap) String() string {
+ return fmt.Sprintf("%s/%d", cap.Name, cap.Version)
+}
+
type capsByName []Cap
func (cs capsByName) Len() int { return len(cs) }