From 4bef3ce284574c7e0e9a76004e076fc686b13bf6 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 13 Feb 2015 23:54:34 +0100 Subject: p2p: print Cap as name/version --- p2p/protocol.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'p2p') 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) } -- cgit